Tutorials › Nonlinear Mixed-Effects Models (NLME) › Degrees of Freedom in Mixed-Effects Likelihood Ratio Tests

Model Selection and Information Criteria · Tutorial 645 of 797

Degrees of Freedom in Mixed-Effects Likelihood Ratio Tests

You will learn to derive the LRT degrees of freedom from the rank of the null constraints and recognize when ordinary chi-square calibration may not apply.

Intermediate 10 min read

What You'll Learn

  • Relate the LRT degrees of freedom to the number of independent restrictions imposed by the null model.
  • Use the rank of a constraint Jacobian when restrictions are expressed through equations.
  • Count degrees of freedom in fixed-effect and random-effects covariance comparisons.
  • Check regularity conditions before using a chi-square reference distribution.
  • Distinguish nested-model LRTs from Wald tests and information-criterion comparisons.

Why the Degrees of Freedom Need to Be Counted

A likelihood ratio statistic measures how much better a larger model can fit than a nested, more restricted model. To interpret that statistic using a chi-square reference distribution, one must specify its degrees of freedom. In a nonlinear mixed-effects (NLME) model, this is not necessarily the number of coefficients whose printed values look different. The relevant quantity is the number of independent restrictions imposed by the null model.

The introductory material on likelihood ratio tests for nested NLME models establishes the statistic and the comparison of maximized likelihoods. Here the emphasis is narrower: determining the correct degrees of freedom, including when several restrictions are redundant or when a covariance structure is simplified.

Definition: For a regular nested-model likelihood ratio test, the degrees of freedom are the difference in the local dimensions of the larger and null parameter spaces. Equivalently, they are the number of independent constraints imposed by the null model on the larger model's parameters. When the null is represented by smooth equations, this number is the rank of their Jacobian at the true null parameter value.

If the larger model has parameter vector \(\theta\) with \(k_1\) locally identifiable free parameters, and the null model has dimension \(k_0\), then the regular nested comparison has

$$ df=k_1-k_0. $$

This dimension difference is the basis for the usual Wilks chi-square result. Let \(\ell_1\) and \(\ell_0\) be the maximized log likelihoods under the larger and null models, respectively. Under the regularity conditions described below, the likelihood ratio statistic

$$ D=2(\ell_1-\ell_0) $$

has an approximate \(\chi^2_{df}\) distribution under \(H_0\). Thus, the degrees of freedom determine the reference distribution used to calculate the p-value; they are not an extra adjustment to the observed statistic.

Counting Independent Restrictions

Suppose the null model is described inside the larger model by \(r\) smooth equations, written \(g(\theta)=0\), where \(g\) is a vector-valued function. The Jacobian matrix \(J\) contains the derivatives of those equations with respect to the components of \(\theta\). If \(J\) has rank \(r\) at the true null parameter, the equations impose \(r\) locally independent restrictions, so the LRT degrees of freedom are \(r\).

The rank matters because written equations can repeat the same information. For example, \(\theta_1=0\) together with \(2\theta_1=0\) gives two equations but only one independent restriction. Conversely, a set of restrictions should not be counted by how many parameter names appear in it; the relevant question is how much the null set reduces the local parameter-space dimension.

A single regular scalar equation imposes one restriction: its gradient is nonzero, so locally it defines a set of codimension one. A single scalar equation can encode a higher-codimension set only in a singular way. For example, \(x^2+y^2=0\) forces both \(x=0\) and \(y=0\), but its gradient is zero at that point. The usual rank-based Wilks argument does not apply there as if this were a regular one-equation constraint; singular cases require separate analysis.

Conditions for the Usual Chi-Square Calibration

The dimension count supplies the degrees of freedom only when the standard regular likelihood ratio approximation is appropriate. In a typical NLME application, check that:

  • The models are nested: every distribution allowed by the null model is also allowed by the larger model.
  • Both likelihoods use the same observations and a compatible likelihood construction, and each model is fitted to its maximum likelihood.
  • The true null parameter is identifiable and lies in a locally regular part of the parameter space. The relevant constraints have the stated rank there.
  • The likelihood is sufficiently smooth near the true parameter, and nuisance parameters are identifiable under the null.
  • The asymptotic approximation is plausible for the amount and design of the data. In mixed-effects settings, the number of independent subjects is often particularly important.

The ordinary result can fail or need special treatment when parameters are on the boundary, are not identifiable under the null, or the constraint set is singular. In those situations, simply subtracting parameter counts does not establish a chi-square reference distribution. Boundary tests for random-effect variances, for example, need their own calibration; they are not resolved by the regular rank count alone.

Worked Example: One Fixed-Effect Slope

Suppose a hypothetical concentration model includes a fixed effect \(\beta_{\mathrm{renal}}\) for a continuous renal-function covariate in the typical clearance. The null model fixes \(\beta_{\mathrm{renal}}=0\); the larger model estimates it. All other structural, random-effect, and residual-error terms are the same. The models are fitted by maximum likelihood to the same observations, and assume the null slope is an identifiable interior value.

Degrees of freedom. The null imposes the one independent equation \(\beta_{\mathrm{renal}}=0\), so \(df=1\). This is a fixed-effect restriction, not a count of subjects or observations.

Suppose the maximized log likelihoods are \(\ell_0=-246.8\) and \(\ell_1=-244.9\). The larger model has the higher log likelihood, as it must for a properly nested comparison fitted to the same data. The statistic is

$$ D=2\{\ell_1-\ell_0\} =2\{-244.9-(-246.8)\} =2(1.9)=3.8. $$

Using the regular \(\chi^2_1\) reference distribution gives \(p\approx0.0513\). At \(\alpha=0.05\), this is just above the significance threshold, so the result does not reject \(H_0\) at that level. The conclusion is about evidence against a zero renal-function slope under this model and calibration; it does not establish that the covariate has no effect.

Worked Example: A Four-Level Fixed-Effect Factor

Consider a hypothetical model in which typical bioavailability may differ across four treatment-formulation groups. Relative to a reference group, the larger model has three fixed-effect contrast coefficients, \(\gamma_1,\gamma_2,\gamma_3\). The null specifies \(\gamma_1=\gamma_2=\gamma_3=0\). Assume the same data, likelihood method, and remaining model structure are used, and that the three contrasts are identifiable.

The three equations constrain three distinct coefficients. Their Jacobian has rank 3, so the test has \(df=3\). This is a joint test of the formulation factor, not three separate one-degree-of-freedom tests.

Suppose \(\ell_0=-301.6\) and \(\ell_1=-297.8\). Then

$$ D=2\{-297.8-(-301.6)\} =2(3.8)=7.6. $$

Against \(\chi^2_3\), the p-value is approximately \(0.0551\). At the 0.05 level, the joint test does not reject the null. The degrees of freedom are 3 because the null removes three independent contrasts, even though the factor is one named covariate in the model formula.

Covariance-Structure Comparisons

The same rule applies to random-effects covariance parameters. For a vector of \(q\) random effects, an unstructured covariance matrix has \(q(q+1)/2\) distinct entries: \(q\) variances and \(q(q-1)/2\) covariances. A diagonal structure retains the variances and constrains each off-diagonal covariance to zero. If all variances are positive and the covariance matrix is in the regular interior, those zero-covariance constraints are independent, and the dimension difference is \(q(q-1)/2\).

The count concerns covariance parameters actually freed or constrained, not all random-effect parameters. Shared fixed effects, variances, and residual-error parameters do not contribute to the difference if they are estimated in both models. It is also important to check that the proposed structures really are nested; two different structures with the same number of parameters do not automatically form a nested comparison.

Worked Example: Unstructured Versus Diagonal Random-Effects Covariance

A hypothetical NLME model has three random effects: one each for typical clearance, volume, and absorption rate. Compare an unstructured \(3\times3\) covariance matrix with a diagonal covariance matrix. The fixed effects, residual-error model, data, and likelihood fitting method are identical in both models. Assume the three random-effect variances are positive and the unstructured covariance estimate lies in the regular positive-definite parameter space.

The unstructured matrix has three variances and three distinct covariances. The diagonal model retains the three variances but sets the three covariances to zero. These are three independent restrictions, so \(df=3\).

Suppose the maximized log likelihoods are \(\ell_0=-214.7\) for the diagonal model and \(\ell_1=-210.5\) for the unstructured model. Then

$$ D=2\{-210.5-(-214.7)\} =2(4.2)=8.4. $$

The \(\chi^2_3\) tail probability is approximately \(0.0384\). At \(\alpha=0.05\), the regular LRT rejects the diagonal covariance structure in favor of allowing covariances, subject to the assumptions stated. The three degrees of freedom come from the three off-diagonal entries, not from the six total entries in the unstructured matrix.

A Short Dimension Justification

The rank rule follows from local dimension. If the larger parameter space has dimension \(k_1\), and the null restrictions have Jacobian rank \(r\), the implicit function theorem says that near a regular null point the set satisfying those restrictions has dimension \(k_1-r\). Therefore the dimension removed by the null is

$$ k_1-(k_1-r)=r. $$

Wilks' result uses this difference in dimension to obtain the asymptotic chi-square degrees of freedom for the likelihood ratio statistic. This argument also explains the warning about singular constraints: when the Jacobian rank does not describe the local geometry, the dimension calculation cannot be justified by this regular argument.

Diagnostics, Alternatives, and Common Pitfalls

Before reporting an LRT, write down the null restrictions explicitly and check their rank. Then verify the nesting and compare the fitted log likelihoods. A larger model should not have a lower maximized likelihood than its nested null model when both are fitted to the same data with the same likelihood definition. Such a result is a warning to check convergence, model implementation, data handling, or the claimed nesting. Also inspect whether parameters are identifiable and whether estimates suggest a boundary or singular case; a numerical optimizer returning a value near a boundary can make the regular calibration questionable.

ApproachWhat it comparesHow degrees of freedom enter
Likelihood ratio testMaximized likelihoods for nested modelsDifference in regular model dimensions; calibrates the statistic
Wald testEstimate relative to its estimated uncertaintyUses the number of tested coefficient restrictions, with its own approximation assumptions
Information criterionFit balanced against a parameter-count penaltyDoes not use an LRT chi-square degrees-of-freedom calibration

These approaches answer related but different questions. An LRT asks whether the loss of fit under specified nested restrictions is unusually large under the null. A Wald test uses estimated coefficients and their uncertainty, and can behave differently when likelihood curvature is poor. Information criteria compare fit and complexity for model selection rather than providing the same null-hypothesis test. None makes a boundary or identifiability problem disappear.

  • Mistake: counting equations rather than independent constraints. Two redundant equations may impose only one restriction. Use the Jacobian rank or the local dimension difference.
  • Mistake: counting every parameter in the larger model. Parameters estimated in both models cancel in the dimension difference. Count only the dimensions removed by the null.
  • Mistake: treating a singular equation as regular. One smooth scalar equation with nonzero gradient imposes one restriction. A singular equation may encode a more complicated set, but the usual rank argument does not justify an ordinary chi-square test there.
  • Mistake: assuming the correct count guarantees a valid p-value. The count gives the regular reference degrees of freedom; nesting, identifiability, interior conditions, and adequate asymptotics must also hold.
Key takeaway: For a regular nested NLME likelihood ratio test, count the independent restrictions imposed by the null. Use the difference in locally identifiable model dimensions—or, for smooth constraints, their Jacobian rank—and separately verify the conditions that justify chi-square calibration.

Check Your Understanding

Try each count or calculation, then compare with the solutions below.

  1. A null model sets two separately identifiable covariate slopes to zero in a larger model. What are the regular LRT degrees of freedom?
  2. An unstructured covariance matrix for four random effects is compared with a diagonal covariance matrix. Assuming positive variances and regularity, how many covariance restrictions are imposed?
  3. Two stated restrictions are \(\theta_1=0\) and \(2\theta_1=0\). How many independent restrictions do they impose?
  4. A nested comparison has \(\ell_0=-88.3\) and \(\ell_1=-85.8\), with two independent regular constraints. Calculate \(D\), state the reference degrees of freedom, and give the approximate p-value.
  5. Why is the equation \(x^2+y^2=0\) not an example of one regular scalar restriction at \((0,0)\)?

Solutions. (1) The null imposes two independent slope restrictions, so \(df=2\). (2) There are \(4(4-1)/2=6\) distinct off-diagonal covariances, hence six restrictions and \(df=6\). (3) Both equations express \(\theta_1=0\); their Jacobian has rank 1, so there is one independent restriction. (4) \(D=2\{-85.8-(-88.3)\}=2(2.5)=5.0\), with \(df=2\). The \(\chi^2_2\) upper-tail p-value is \(e^{-5/2}\approx0.0821\), so the result is not significant at \(\alpha=0.05\). (5) The gradient is \((2x,2y)\), which equals \((0,0)\) at the origin. The constraint is singular there, so the regular one-equation rank argument does not apply.