Tutorials › Generalized Linear Models › Testing Blocks of Coefficients

Nested Models and Deviance Tests · Tutorial 311 of 981

Testing Blocks of Coefficients

Learn to formulate, calculate, and interpret a likelihood-ratio deviance test for several regression coefficients at once.

Intermediate 10 min read

What You'll Learn

  • Formulate a joint null hypothesis for a block of GLM coefficients
  • Connect the nested-model deviance difference to the likelihood-ratio statistic
  • Determine the test degrees of freedom from the number of independent restrictions
  • Test all indicators for a categorical predictor as one block
  • Interpret a chi-square calibrated result without confusing it with separate coefficient tests

Why Test a Block of Coefficients?

A categorical predictor with several levels is usually represented in a regression model by several coefficients. The scientific question may concern the predictor as a whole: after adjustment for other variables, is the response related to which category an observation belongs to? Testing each coefficient separately does not answer that joint question. A block test instead compares a reduced model, in which the whole block is absent or constrained, with a full model that includes it.

The comparison is a likelihood-ratio test. In a generalized linear model (GLM), its statistic can be computed as the reduced model's residual deviance minus the full model's residual deviance, provided both deviance values use the same likelihood and saturated-model reference. The result tests the specified block jointly; it does not say that every coefficient in the block is individually nonzero.

Hypotheses and the Nested-Model Statistic

Definition: Suppose a full GLM has parameter vector \(\beta\), and a block of \(q\) coefficients is subject to \(q\) independent restrictions under the null. Write the joint hypothesis as \(H_0:R\beta=r\), where \(R\) has rank \(q\). The reduced model is the model satisfying those restrictions; the full model allows the block to vary. The likelihood-ratio statistic is \(G^2=2\{\ell_F(\hat\beta_F)-\ell_R(\hat\beta_R)\}\), where each estimate maximizes the log-likelihood in its respective model.

For the common case of testing a coefficient block \(\gamma\) against zero, the hypothesis is \(H_0:\gamma=0\). In a factor with \(K\) levels represented by \(K-1\) indicators relative to a reference level, the block has \(q=K-1\) coefficients. The reference category is part of the chosen coding, but the joint question is whether category membership contributes any effect beyond the other terms in the model.

Theorem: For two nested models fitted to the same data with the same likelihood, let \(D_R\) and \(D_F\) be their residual deviances, for the reduced and full models respectively. Then \(D_R-D_F=2\{\ell_F(\hat\beta_F)-\ell_R(\hat\beta_R)\}=G^2\). If the null is true, the models are identifiable and regular, the true parameter is an interior point, the likelihood is sufficiently smooth, and the Fisher information is nonsingular, Wilks' theorem gives \(G^2\xrightarrow{d}\chi^2_q\), where \(q\) is the number of independent restrictions.

The deviance identity follows directly from its definition. For a given response data set, write the deviance at a fitted model as \(D=2\{\ell_{\mathrm{sat}}-\ell(\hat\beta)\}\), with the same saturated-model log-likelihood \(\ell_{\mathrm{sat}}\) for both fits. Subtracting cancels that common term:

$$ D_R-D_F =2\{\ell_{\mathrm{sat}}-\ell_R(\hat\beta_R)\} -2\{\ell_{\mathrm{sat}}-\ell_F(\hat\beta_F)\} =2\{\ell_F(\hat\beta_F)-\ell_R(\hat\beta_R)\}. $$

The reduced model is contained in the full model, so maximizing over the larger parameter space cannot lower the maximized log-likelihood: \(\ell_F(\hat\beta_F)\geq \ell_R(\hat\beta_R)\). Thus \(G^2\geq0\), apart from numerical rounding. For the degrees of freedom, the null imposes \(q\) independent restrictions, reducing the parameter-space dimension by \(q\). Under the regularity conditions in the theorem, Wilks' theorem therefore gives the stated chi-square reference distribution. This is an asymptotic calibration, not a claim that the statistic has an exact chi-square distribution in every finite sample.

Worked Block Tests

Worked Example: Testing Two Poisson Log-Mean Coefficients

Suppose two independent Poisson counts are observed, \(Y_1=2\) and \(Y_2=8\). Compare the reduced model with fixed means \(\mu_1=\mu_2=5\) to the full model \(\log(\mu_i)=\log(5)+\beta_i\), for \(i=1,2\). The joint null is \(H_0:\beta_1=\beta_2=0\), a block of two coefficients.

Under the full model, the maximum-likelihood estimates are \(\hat\mu_1=2\) and \(\hat\mu_2=8\). In the Poisson log-likelihood, the terms \(-\log(Y_i!)\) cancel between models. The difference in log-likelihood is therefore

$$ \ell_F-\ell_R =\sum_{i=1}^2\left\{Y_i\log\left(\frac{\hat\mu_i}{5}\right)-(\hat\mu_i-5)\right\}. $$

The linear terms sum to \(-(2-5)-(8-5)=0\). Hence

$$ G^2=2\left\{2\log(2/5)+8\log(8/5)\right\} =2\{2\log(0.4)+8\log(1.6)\} \approx 3.8549. $$

There are two independent restrictions, so the reference distribution is \(\chi^2_2\). Its upper-tail probability is \(\exp(-G^2/2)\), which here is \(\exp(-1.92745)\approx 0.1455\). At a 5% significance level, this result does not provide sufficient evidence against the joint null. The approximation is being illustrated with only two counts; in practice, a sample this small calls for care about the adequacy of asymptotic calibration.

Worked Example: Testing a Three-Level Predictor in Logistic Regression

In three groups, each with 10 binary outcomes, the numbers of successes are 2, 5, and 8. Consider a logistic model with an intercept and two indicator coefficients for group, and test the two coefficients jointly against zero. Under the reduced model, all groups have one fitted success probability. The pooled estimate is \((2+5+8)/30=0.5\). Under the full model, the fitted group probabilities are \(0.2\), \(0.5\), and \(0.8\).

The binomial coefficients in the likelihood cancel in the comparison. The middle group's fitted probability is unchanged, so its log-likelihood contribution to the difference is zero. For the first group, the contribution is \(2\log(0.2/0.5)+8\log(0.8/0.5)=2\log(0.4)+8\log(1.6)\). The third group contributes \(8\log(0.8/0.5)+2\log(0.2/0.5)\), the same quantity. Thus

$$ G^2=2\left[2\{2\log(0.4)+8\log(1.6)\}\right] \approx 7.7098. $$

The test has \(q=2\) degrees of freedom, not one test for each of the two indicator coefficients. For \(\chi^2_2\), the upper-tail probability is \(\exp(-7.7098/2)\approx 0.0212\). At the 5% level, the data provide evidence that the response probability differs across the three groups, after accounting for the intercept. This conclusion is about the group effect as a whole; it does not establish which pairs of groups differ.

Worked Example: A Block Added to an Adjusted Model

A fitted logistic-regression analysis adjusts for age and smoking status. The reduced model has log-likelihood \(-89.000\); the full model adds three indicator coefficients for a four-level occupational category and has log-likelihood \(-82.704\). Test whether occupation contributes a joint effect after adjustment.

The null sets all three added coefficients to zero. The statistic is

$$ G^2=2\{(-82.704)-(-89.000)\}=2(6.296)=12.592. $$

The degrees of freedom are three because the full model adds three independently estimable coefficients. Under the chi-square approximation, the upper-tail probability for \(\chi^2_3\) at 12.592 is about \(0.0056\). This is evidence against the joint null at the 5% level: occupation improves the fit conditional on the adjustment variables. It is not a claim that every occupational coefficient is individually significant, nor does the test itself identify which categories account for the improvement.

Interpreting the Test and Avoiding Common Errors

A block test answers a specific conditional question: does allowing this set of coefficients to vary improve the likelihood enough to be inconsistent with the joint null under the chosen calibration? The interpretation depends on the reduced model. If age and smoking status appear in both models, the test concerns the block's contribution after adjustment for those terms. The result is not automatically a causal effect.

For an ordinary categorical predictor with \(K\) levels, a reference-level coding uses \(K-1\) indicators, so testing all of them together usually has \(K-1\) degrees of freedom. More generally, use the number of independent restrictions, not simply the number of coefficient labels written down: constraints can be redundant, and the effective rank determines the dimension difference. Both models must be fitted to the same response observations using the same likelihood specification for the deviance difference to represent this likelihood-ratio test.

  • Mistake: testing each indicator and treating those results as the overall factor test. Separate tests answer separate coefficient questions and do not substitute for the joint null. Correction: fit the reduced model without the factor block and compare it with the full model containing the whole block.
  • Mistake: using the number of categories as the degrees of freedom. With an intercept and reference coding, a \(K\)-level factor contributes \(K-1\) coefficients. Correction: count the independent restrictions, equivalently the parameter-dimension difference.
  • Mistake: interpreting a nonsignificant block test as proof that the effects are zero. A failure to reject can reflect limited information as well as a small effect. Correction: report the statistic, degrees of freedom, calibration and context; do not turn failure to reject into evidence of exact equality.
Key takeaway: To test a coefficient block, compare nested reduced and full models, calculate \(D_R-D_F=2(\ell_F-\ell_R)\), and calibrate against \(\chi^2_q\) when regularity conditions justify Wilks' approximation. The test is joint: its conclusion concerns the block, not each coefficient separately.

Check Your Understanding

Use these questions to check the formulation, calculation and interpretation of a block test.

  1. A five-level predictor is represented by reference-level indicators. How many degrees of freedom does the usual joint test have, and what is its null hypothesis?
  2. Why do the saturated-model log-likelihood terms cancel when subtracting the reduced and full residual deviances?
  3. A full model has log-likelihood \(-40\), and its reduced model has log-likelihood \(-44\). What is the likelihood-ratio statistic?
  4. What does a significant joint test establish, and what does it not establish about the individual coefficients?
  5. Name two conditions that support using the chi-square approximation for the likelihood-ratio statistic.
Clinical Biostats