Why Small Errors Change a Deviance Test
A deviance test compares how well two models describe the same response data. The arithmetic is short, but a reversed subtraction, an incorrect degrees of freedom, or an invalid comparison can turn a meaningful test into a misleading one. These errors matter because the test statistic and its reference distribution work together: correct arithmetic cannot rescue an invalid model comparison.
The essential setup is a reduced model contained within a full model, fitted to the same observations with a common likelihood. The null hypothesis says that the reduced-model restrictions hold. Under regularity conditions, the deviance difference is compared with a chi-square distribution whose degrees of freedom count the independent restrictions.
The saturated-model term cancels in the subtraction, but using the same response data and likelihood is still essential. Under the null hypothesis, if the reduced model is true and the comparison is regular, Wilks’ theorem gives an approximate \(\chi^2_q\) reference distribution. Here \(q\) is the dimension difference between the models, equivalently the number of independent restrictions imposed by the reduced model. The p-value is the upper-tail probability \(P(\chi^2_q\geq \Delta D)\).
For this calibration, the null parameter must be an interior point of a regular model, the parameters must be identifiable, the information matrix must be nonsingular, and the sample size must support the usual large-sample approximation. The observations must be analyzed under a common, correctly specified likelihood. Boundary parameters, severe sparsity, or other nonregular features can require a different calibration.
Error 1: Reversing the Deviance Subtraction
The full model can reproduce every fit available to the reduced model and can also choose the reduced-model parameter values. Consequently, maximization cannot make its log-likelihood smaller. The deviance difference must therefore be calculated as reduced deviance minus full deviance—not the reverse.
Proof. Every parameter value permitted by the reduced model is also permitted by the full model. The supremum of the log-likelihood over the full parameter space is therefore at least its supremum over the reduced parameter space: \(\ell_F\geq\ell_R\). Subtracting and multiplying by two gives \(2(\ell_F-\ell_R)\geq0\). Since the two deviances use the same saturated-model log-likelihood, \(D_R-D_F=2(\ell_F-\ell_R)\). \(\square\)
Worked Example: Checking the Sign in a Poisson Comparison
Suppose independent counts have Poisson response distributions. A reduced loglinear model omits two terms, and a full model includes them. The fits use the same observations and likelihood, with maximized log-likelihoods \(\ell_R=-128.4\) and \(\ell_F=-123.1\). The reduced model is nested in the full model, and the two added terms impose two independent restrictions under the null.
First check the maximized log-likelihoods: \(-123.1>-128.4\), as required for the larger parameter space. The statistic is $$ \Delta D=2\{\ell_F-\ell_R\} =2\{-123.1-(-128.4)\} =2(5.3)=10.6. $$
The degrees of freedom are \(q=2\), one for each independent restriction. For two degrees of freedom the upper-tail probability is \(P(\chi^2_2\geq x)=e^{-x/2}\), so the p-value is \(e^{-10.6/2}=e^{-5.3}\approx0.0050\). Reversing the subtraction gives \(-10.6\), which cannot be a likelihood-ratio deviance statistic for these nested fits.
Error 2: Counting Terms Instead of Restrictions
Degrees of freedom do not generally equal the number of variable names, formula terms, or rows in a model table. They count the independent parameter restrictions being tested. For a full-rank design, this is usually the difference in the models’ coefficient dimensions. If a term has several coefficients, testing the whole term requires one degree of freedom per independent coefficient, not one degree of freedom for the term as a label.
Worked Example: A Four-Level Factor Requires Three Restrictions
Consider grouped-binomial responses with a logit link. The reduced model has an intercept only; the full model adds a four-level factor. With an intercept and three independent contrasts, the factor’s four levels add three coefficients. Suppose the fitted residual deviances are \(D_R=27.4100\) and \(D_F=19.5953\). Thus $$ \Delta D=27.4100-19.5953=7.8147. $$
The null hypothesis sets all three factor contrasts to zero, so the test has \(q=3\), not \(q=1\). The 95th percentile of \(\chi^2_3\) is approximately \(7.8147\), giving an upper-tail p-value of approximately \(0.0500\). Using one degree of freedom would compare the same statistic to the wrong reference distribution and produce a different, invalid p-value.
The count can also be less than the number of written coefficients if some are aliased or otherwise not estimable. In that case use the rank difference—the number of additional independent estimable parameters—not a raw coefficient count.
Error 3: Treating Sequential Tests as Order-Free
A sequential deviance test measures the improvement from adding a term to the model containing the terms entered before it. If predictors are associated, the first term can account for variation that a later term could also explain. Reversing the order can therefore change the individual sequential contributions and their p-values. The comparison of the same reduced and full models does not change; it is the intermediate models, and hence the sequential questions, that differ.
This distinction follows directly from subtraction. Let \(M_0\) be a starting model, and let \(M_A\), \(M_B\), and \(M_{AB}\) denote models with terms \(A\), \(B\), and both terms, respectively. The sequential contributions are \(D_0-D_A\) followed by \(D_A-D_{AB}\) when \(A\) enters first, but \(D_0-D_B\) followed by \(D_B-D_{AB}\) when \(B\) enters first.
Derivation. Each sum cancels its intermediate deviance: \(D_0-D_A+D_A-D_{AB}=D_0-D_{AB}\), and \(D_0-D_B+D_B-D_{AB}=D_0-D_{AB}\). The first contribution in the \(A\)-first order is \(D_0-D_A\); in the \(B\)-first order it is \(D_0-D_B\). There is no algebraic requirement that \(D_A=D_B\), so these first contributions, and correspondingly the second contributions, may differ. \(\square\)
Worked Example: The Same Terms, Two Sequential Orders
For a Poisson loglinear model, suppose the fitted deviances for the intercept-only, \(A\)-only, \(B\)-only, and \(A+B\) models are \(120\), \(112\), \(114\), and \(109\), respectively. Let \(A\) and \(B\) each contribute one independent coefficient. All four models use the same data and likelihood.
Entering \(A\) first gives a reduction of \(120-112=8\). Adding \(B\) after \(A\) gives \(112-109=3\). Entering \(B\) first instead gives \(120-114=6\), followed by \(114-109=5\) for adding \(A\). In both orders the total is \(8+3=6+5=11=120-109\).
For one degree of freedom, these reductions have approximate chi-square upper-tail p-values \(0.0047\), \(0.0833\), \(0.0143\), and \(0.0253\), respectively. Thus the sequential conclusion about a particular term depends on which other term has already entered. A partial comparison of the full model with the model omitting \(A\), for example, asks a fixed question about \(A\) given \(B\); it should not be confused with the sequential test for \(A\) when entered first.
Error 4: Applying a Nested-Model Test to Nonnested Models
A chi-square deviance-difference test is not justified merely because two fitted models use the same response or because their deviances can be subtracted. The reduced-model parameter space must be contained in the full-model parameter space. Without that nesting, the difference does not represent the likelihood-ratio statistic for the restrictions of one model against the other, and the degrees of freedom cannot be obtained by counting restrictions in that way.
Worked Example: Two Logistic Models That Are Not Nested
Suppose the same binary responses are modeled in two ways. Model \(M_X\) uses \(P(Y_i=1)=\operatorname{logit}^{-1}(\alpha+\beta x_i)\), while model \(M_Z\) uses \(P(Y_i=1)=\operatorname{logit}^{-1}(\gamma+\delta z_i)\). Assume the predictors are not identical or deterministically interchangeable, so neither model contains the other. Suppose their maximized log-likelihoods are \(-48.0\) and \(-46.0\), respectively.
The deviance difference, using the common saturated-model likelihood, is \(D_X-D_Z=2\{(-46.0)-(-48.0)\}=4.0\). This arithmetic says that \(M_Z\) attained a larger maximized log-likelihood. It does not give a valid nested-model chi-square test: neither model supplies restrictions within the other, so there is no corresponding nested null and no degrees of freedom obtained from a parameter-dimension difference.
A valid comparison may be possible by specifying an appropriate encompassing model and testing restrictions within it, if that model and the scientific hypotheses justify the comparison. Otherwise, use a method designed for the actual nonnested question. Do not turn the difference of two deviances into a chi-square p-value by choosing a convenient degrees of freedom.
A Practical Check Before Reporting
Before interpreting a deviance-test result, verify the comparison in a fixed order. This catches the common errors before a p-value gives them a misleading appearance of precision.
Confirm that both fits use the same response data and a common likelihood, with the same treatment of nuisance parameters required for the comparison.
Verify that every parameter value allowed by the reduced model is allowed by the full model. If neither model contains the other, do not use the ordinary nested deviance test.
Compute \(D_R-D_F=2(\ell_F-\ell_R)\). For nested maximum-likelihood fits this should be nonnegative, up to numerical rounding.
Use the dimension or effective-rank difference for the hypothesis being tested. For sequential tests, state which terms were already in the model.
Use the chi-square approximation only when the regularity conditions are credible. If parameters are on a boundary or data are sparse, revisit the calibration rather than reporting the usual p-value automatically.
The most useful habit is to write down the null hypothesis in words and as restrictions on the full model before calculating anything. That makes the nesting, the degrees of freedom, and the interpretation of any sequential ordering explicit. A deviance statistic is evidence about a particular comparison—not a general score for which of several models is “best.”
Check Your Understanding
For each question, identify the comparison being made before deciding how to calculate or interpret a test.
- A nested full model has a larger maximized log-likelihood than its reduced model. Which deviance difference has the nonnegative likelihood-ratio statistic, and why?
- A five-level factor is added to a full-rank model using an intercept and standard contrasts. How many independent coefficients does the factor add, and what should be checked before using that count as the test degrees of freedom?
- Why can the sequential deviance attributed to a predictor change when another predictor is entered first, even though the total deviance reduction to the same full model does not change?
- Two models fit the same binary response but use different, nonnested predictors. What does their deviance difference describe, and why is it not automatically a chi-square test statistic?
- Name two conditions or features that could make the usual chi-square calibration unreliable even when the models are nested.