From Grouped Counts to Quasi-Binomial Inference
Grouped binomial data record a number of successes out of a trial total for each covariate pattern. When trial totals differ, a group with more trials generally supplies more information about its success probability. A grouped quasi-binomial model accommodates this structure while allowing the variance to be larger than the binomial variance by a dispersion factor \(\phi\).
The analysis has several linked parts: fit the mean model, examine Pearson residuals to estimate dispersion, scale coefficient uncertainty by that estimate, and then assess a coefficient contrast. The calculations below show each step, including why unequal trial totals appear in the variance and Pearson statistic even though they cancel from the logit quasi-score.
Why the Grouped Logit Score Simplifies
For a quasi-score, the contribution from group \(i\) is the derivative of its mean with respect to the coefficients, multiplied by its observed-minus-fitted response and divided by its variance. For the logit link, \(d\pi_i/d\boldsymbol{\beta}=\pi_i(1-\pi_i)\mathbf{x}_i\), so \(d\mu_i/d\boldsymbol{\beta}=n_i\pi_i(1-\pi_i)\mathbf{x}_i\).
To verify the result, divide the derivative of the mean by the variance for each group:
Multiplying by \(Y_i-\mu_i\) and summing gives the displayed quasi-score. In particular, a denominator of \(\pi_i(1-\pi_i)\) must not be left in the score equation: the logit derivative cancels that variance factor.
Worked Example: Fitting Unequal Grouped Trial Counts
Worked Example: Fitting Unequal Grouped Trial Counts
Suppose the covariate is \(x_i\), and the grouped observations are as follows. The trial totals are unequal, and the response \(Y_i\) is the number of successes.
| \(x_i\) | \(n_i\) | \(Y_i\) |
|---|---|---|
| -1 | 8 | 4 |
| 0 | 12 | 3 |
| 1 | 8 | 6 |
| 2 | 10 | 10 |
Fit \(\operatorname{logit}(\pi_i)=\beta_0+\beta_1x_i\). Consider \(\hat\beta_0=0\) and \(\hat\beta_1=\log 3\). These give fitted probabilities \((1/4,1/2,3/4,9/10)\): for example, at \(x=2\) the fitted odds are \(e^{2\log 3}=9\), hence the probability is \(9/(1+9)=9/10\).
The fitted means \(n_i\hat\pi_i\) are \(2,6,6,9\), so the residuals \(Y_i-n_i\hat\pi_i\) are \(2,-3,0,1\). The intercept component of the score equation is \(2-3+0+1=0\). The slope component is \((-1)(2)+(0)(-3)+(1)(0)+(2)(1)=0\). Thus both quasi-score equations hold.
These equations identify the fitted coefficients, not merely a convenient set of probabilities. For this design the information matrix is positive definite, so the logit score is strictly decreasing in every nonzero coefficient direction and the root is unique. The unequal trial totals have not disappeared from the model: they determine the fitted means, variances, and coefficient uncertainty.
Pearson Dispersion and Coefficient Uncertainty
The Pearson residual for group \(i\) divides its response residual by the square root of its fitted variance without dispersion, \(n_i\hat\pi_i(1-\hat\pi_i)\). The Pearson statistic is the sum of squared Pearson residuals. A common estimate of \(\phi\) divides that statistic by the residual degrees of freedom \(m-p\), where \(p\) is the number of fitted coefficients. This is an estimation convention, not an exact finite-sample identity.
Worked Example: Estimating Dispersion and the Covariance Matrix
Continue with the four-group fit above, where \(m=4\) and \(p=2\). The fitted variances before multiplying by \(\phi\) are \(8(1/4)(3/4)=1.5\), \(12(1/2)(1/2)=3\), \(8(3/4)(1/4)=1.5\), and \(10(9/10)(1/10)=0.9\).
Using residuals \(2,-3,0,1\), the Pearson statistic is
There are \(m-p=2\) residual degrees of freedom. The Pearson dispersion estimate is therefore \(\hat\phi=(61/9)/2=61/18\approx3.3889\).
For the coefficient covariance, let \(w_i=n_i\hat\pi_i(1-\hat\pi_i)\). Here the weights are \(1.5,3,1.5,0.9\). With rows \((1,x_i)\), the unscaled information matrix is
The lower-right entry is the unscaled variance estimate for the slope. Multiplication by \(\hat\phi=61/18\) gives \(\widehat{\operatorname{Var}}(\hat\beta_1)=(61/18)(23/141)=1403/2538\approx0.5528\), and hence \(\operatorname{SE}(\hat\beta_1)\approx\sqrt{0.5528}=0.7435\).
The covariance scaling has a direct quasi-score justification. At the true coefficients, write \(\mathbf{A}=\sum_i n_i\pi_i(1-\pi_i)\mathbf{x}_i\mathbf{x}_i^\top\). For independent groups, the negative derivative of the quasi-score is \(\mathbf{A}/\phi\). Its variance is also \(\mathbf{A}/\phi\), because \(\operatorname{Var}(Y_i)=\phi n_i\pi_i(1-\pi_i)\). The resulting sandwich covariance is \((\mathbf{A}/\phi)^{-1}(\mathbf{A}/\phi)(\mathbf{A}/\phi)^{-1} =\phi\mathbf{A}^{-1}\). Replacing unknown quantities by fitted values and \(\phi\) by \(\hat\phi\) yields the covariance estimate used above. This argument requires independent groups, finite stated variances, and a full-rank design with fitted probabilities strictly between zero and one. \(\square\)
Worked Example: Testing the Slope Contrast
Worked Example: Testing the Slope Contrast
In the fitted model above, test \(H_0:\beta_1=0\) against a two-sided alternative. This is the contrast \(c^\top\boldsymbol{\beta}\) with \(c=(0,1)^\top\). Its estimate is \(\hat\beta_1=\log 3\approx1.0986\), and its dispersion-adjusted standard error is \(0.7435\).
The test statistic is \(t=1.0986/0.7435\approx1.477\). Using the residual degrees of freedom \(m-p=2\), the usual estimated-dispersion quasi-GLM procedure compares this statistic with a \(t\) distribution on 2 degrees of freedom. The two-sided \(p\)-value is approximately \(0.278\), so this small example does not provide strong evidence against a zero slope under that approximation.
The estimated slope also has a direct mean-model interpretation: a one-unit increase in \(x\) multiplies the fitted odds of success by \(e^{\hat\beta_1}=3\). This is an odds ratio from the fitted mean relationship; the dispersion estimate changes its estimated uncertainty, not the fitted odds ratio.
Unequal Trial Totals Are Not Equal Group Weights
Worked Example: A Common Probability With Unequal Totals
Suppose three groups have trial totals \(5,20,10\) and success counts \(1,12,7\), respectively. Fit an intercept-only quasi-binomial model, so all groups share probability \(\pi\). Its score equation is \((1-5\pi)+(12-20\pi)+(7-10\pi)=0\). Solving gives \(20-35\pi=0\), hence \(\hat\pi=20/35=4/7\approx0.5714\).
The separate observed proportions are \(1/5=0.2\), \(12/20=0.6\), and \(7/10=0.7\); their unweighted average is \((0.2+0.6+0.7)/3=0.5\), not the fitted common probability. The score equation pools successes relative to the total number of trials, so the groups with more trials contribute more to this intercept-only estimate.
Common Mistakes and Practical Interpretation
- Leaving a variance factor in the score. Writing a score proportional to \(\sum_i\mathbf{x}_i(Y_i-n_i\pi_i)/\{\pi_i(1-\pi_i)\}\) fails to account for the logit derivative. The derivative contributes \(n_i\pi_i(1-\pi_i)\mathbf{x}_i\), which cancels the same factor in the variance. The correct estimating equation is \(\sum_i\mathbf{x}_i(Y_i-n_i\pi_i)=\mathbf{0}\).
- Averaging group proportions equally. This generally ignores unequal trial totals. For an intercept-only model the score yields total successes divided by total trials, as the previous calculation demonstrates.
- Using the unscaled covariance after estimating overdispersion. The inverse information alone treats the dispersion factor as one. When the Pearson estimate exceeds one, multiply that matrix by \(\hat\phi\) before calculating standard errors.
- Treating quasi-inference as exact likelihood inference. The mean and variance specification supports quasi-score estimation and approximate dispersion-adjusted tests; it does not supply a full binomial likelihood for these data.
In practice, report the coefficient estimates and their mean-model interpretation alongside the dispersion estimate, adjusted standard errors, and the method used for the contrast test. Unequal trial totals enter the fitted means and the variance-based calculations, even when the logit quasi-score simplifies to a residual sum.
Check Your Understanding
Use the model and calculations in this tutorial to check your understanding.
- For a grouped logit model, show the cancellation that removes \(\pi_i(1-\pi_i)\) from the quasi-score contribution.
- For the four-group example, verify the fitted mean and residual for the group with \(x=2\).
- Why is the Pearson statistic divided by \(m-p\) when forming the displayed dispersion estimate?
- What is the estimated odds ratio for a one-unit increase in \(x\), and does the Pearson dispersion estimate change that point estimate?
- In the intercept-only example, explain why the fitted probability is not the unweighted mean of the three observed proportions.