Introduction
A grouped binomial response records a number of successes out of a known number of trials for each covariate pattern. For example, a clinic might report that 8 of 12 patients responded to a treatment at one dose and 3 of 5 responded at another. These are not two equally precise measurements of a response proportion: the groups have different numbers of trials. The likelihood, score, and curvature must retain that difference.
This tutorial derives the regression score and observed Hessian for independent grouped binomial counts under a logit link. The central feature is simple but consequential: a group contributes its success count minus its expected success count, \(y_i-m_i p_i\), to the score. Equivalently, its residual in proportion units is weighted by its trial count \(m_i\).
Grouped Binomial Logit Model
The count \(Y_i\) takes values \(0,1,\ldots,m_i\). Conditional on the fixed design and trial counts, the probability of observing \(Y_i=y_i\) is
Independence makes the likelihood the product of these probabilities. Writing \(\eta_i=x_i^\mathsf{T}\beta\), the logit model gives \(\log(p_i)=\eta_i-\log(1+\exp(\eta_i))\) and \(\log(1-p_i)=-\log(1+\exp(\eta_i))\). Therefore the log-likelihood is
The binomial coefficient is part of the grouped-data likelihood, but it does not depend on \(\beta\). It contributes no terms to either the score or the Hessian.
Deriving the Score Equation
For each group, \(\partial\eta_i/\partial\beta=x_i\), while differentiating the log-likelihood contribution with respect to \(\eta_i\) gives \(y_i-m_i p_i\). The chain rule then gives the vector score.
A finite maximum-likelihood estimate \(\hat\beta\), if it exists in the parameter space, satisfies the score equations \(U(\hat\beta)=0\). In proportion units, when \(r_i=y_i/m_i\) is the observed group proportion, the same score is
Thus a group with a larger trial count contributes more for the same discrepancy between its observed and fitted proportions. This weighting is not an additional modeling choice: it follows from the binomial likelihood.
Worked Example: Computing a Score and Hessian
Consider two groups with \((m_1,y_1)=(4,3)\) and \((m_2,y_2)=(6,2)\), and design vectors \(x_1=(1,0)^\mathsf{T}\) and \(x_2=(1,1)^\mathsf{T}\). Evaluate the score and Hessian at \(\beta=(0,-\log 2)^\mathsf{T}\).
For group 1, \(\eta_1=0\), so \(p_1=1/2\). Its success residual is \(y_1-m_1p_1=3-4(1/2)=1\). For group 2, \(\eta_2=-\log 2\), so \(p_2=1/3\), and its residual is \(2-6(1/3)=0\). Consequently,
The Hessian contribution from group 1 has weight \(m_1p_1(1-p_1)=4(1/2)(1/2)=1\). The contribution from group 2 has weight \(m_2p_2(1-p_2)=6(1/3)(2/3)=4/3\). Hence
The score is not zero at this coefficient value, and the two groups affect the curvature according to both their trial counts and their fitted probabilities.
Observed Hessian and Likelihood Curvature
Differentiate the score once more. Since \(p_i=\exp(\eta_i)/\{1+\exp(\eta_i)\}\), its derivative with respect to \(\eta_i\) is \(p_i(1-p_i)\). Therefore the derivative of \(y_i-m_i p_i\) with respect to \(\beta\) is \(-m_i p_i(1-p_i)x_i\). The resulting observed Hessian is
In this model the Hessian does not depend on the observed counts \(y_i\); for a fixed \(\beta\) it is also the expected Hessian. The negative sign describes downward likelihood curvature. More precisely, for any vector \(a\in\mathbb{R}^p\),
Thus the Hessian is negative semidefinite at every finite \(\beta\). Because \(m_i>0\) and finite logit probabilities satisfy \(0<p_i<1\), it is negative definite exactly when the design vectors span \(\mathbb{R}^p\). If they do not, some nonzero direction \(a\) has \(x_i^\mathsf{T}a=0\) for every group, and the quadratic form in that direction is zero. If they do span \(\mathbb{R}^p\), every nonzero \(a\) has at least one nonzero \(x_i^\mathsf{T}a\), making the sum strictly negative. This is a statement about curvature; it does not by itself guarantee that a finite maximum-likelihood estimate exists.
Worked Example: An Intercept-Only Fit
Suppose three independent groups have trial-success pairs \((5,4)\), \((10,3)\), and \((5,2)\). Fit a model with an intercept only, so every group has the same success probability \(p\) and \(\eta=\beta\).
The score equation is the sum of the group success residuals:
Setting the score to zero gives \(p=9/20=0.45\). The corresponding logit estimate is \(\hat\beta=\log\{0.45/(1-0.45)\}=\log(9/11)\). The fitted success counts are \(5(0.45)=2.25\), \(10(0.45)=4.5\), and \(5(0.45)=2.25\). Their sum is 9, equal to the observed total number of successes, as the intercept score equation requires.
At this fit, the Hessian is
All groups contribute to the curvature, and their trial counts sum to 20.
Why Aggregation and Trial Counts Matter
A group count can also be understood as a compressed record of \(m_i\) Bernoulli outcomes that share the same success probability. If those outcomes were observed separately, their likelihood contribution would be \(p_i^{y_i}(1-p_i)^{m_i-y_i}\). The grouped count likelihood multiplies this by \(\binom{m_i}{y_i}\), the number of distinct binary sequences producing that count. This factor is independent of \(\beta\), so expanding or grouping the observations gives the same score and Hessian when all trials in a group have the same covariates and probability.
This equivalence concerns the likelihood for \(\beta\); it does not mean that one may discard the trial counts. They determine how many Bernoulli outcomes each group represents and therefore appear in both the expected counts \(m_i p_i\) and the curvature weights \(m_i p_i(1-p_i)\).
Worked Example: Why Unweighted Proportion Residuals Fail
Consider an intercept-only model with two groups: \(m_1=2,y_1=2\) and \(m_2=8,y_2=0\). Evaluate the score at \(p=1/2\). The observed proportions are 1 and 0, so their unweighted residuals are \(1-1/2=1/2\) and \(0-1/2=-1/2\). These happen to sum to zero.
But the grouped-binomial score is not the unweighted sum of proportion residuals. Its correct value is
Equivalently, weighting the proportion residuals by their trial counts gives \(2(1/2)+8(-1/2)=1-4=-3\). Therefore \(p=1/2\) does not solve the score equation. In fact, the intercept-only maximum-likelihood estimate is the pooled proportion \((2+0)/(2+8)=0.2\), not the unweighted average of the two observed proportions.
Common Pitfall
A common error is to replace the count residual \(y_i-m_i p_i\) with the proportion residual \(y_i/m_i-p_i\) and then sum those residuals without weights. The two forms are equivalent only when the proportion residual for each group is multiplied by \(m_i\). Omitting this factor treats a group based on two trials as equally informative as one based on twenty trials.
Check Your Understanding
Use the grouped-binomial logit model and show the role of the trial count in each answer.
- Write the likelihood contribution of a group with \(m_i\) trials and \(y_i\) successes, including its binomial coefficient.
- Express the score using the observed proportion \(r_i=y_i/m_i\). What factor must multiply \(r_i-p_i\)?
- For an intercept-only model, explain why the score equation equates total observed successes with total fitted successes.
- State the grouped-binomial logit Hessian and explain why its quadratic form is never positive.
- Why does an unweighted sum of group proportion residuals generally fail to give the grouped-binomial score equation?