Tutorials › Nonlinear Mixed-Effects Models (NLME) › Worked Likelihood Ratio Tests for NLME Models

Model Selection and Information Criteria · Tutorial 649 of 797

Worked Likelihood Ratio Tests for NLME Models

Work through paired NLME fit summaries to compute likelihood ratio tests, choose the correct degrees of freedom, and judge when the usual chi-square reference is appropriate.

Intermediate 11 min read

What You'll Learn

  • Calculate likelihood ratio statistics from log-likelihood or negative-two-log-likelihood summaries.
  • Identify the null and alternative models and verify that the fitted models are nested.
  • Assign degrees of freedom from the number of independent restrictions being tested.
  • Calculate and interpret chi-square p-values for fixed-effect and regular covariance-parameter tests.
  • Check when ML or REML likelihoods are comparable and recognize settings where the usual chi-square calibration needs care.

From Paired Fits to a Test

A likelihood ratio test (LRT) turns the improvement in fit between two nested models into a test statistic. In an NLME analysis, the calculation is often short; the harder work is checking that the two fits are genuinely comparable and that the statistic has the proposed reference distribution. This tutorial develops those checks alongside the arithmetic, for fixed-effect restrictions and regular covariance-parameter restrictions.

Definition: Let \(M_0\) be a restricted (null) model and \(M_1\) a more general (alternative) model that contains \(M_0\) as a special case. If \(\ell_0\) and \(\ell_1\) are their maximized log likelihoods, the likelihood ratio statistic is $$ \Lambda = 2(\ell_1-\ell_0). $$ When fit summaries report \(-2\ell\), the equivalent calculation is \(\Lambda=(-2\ell_0)-(-2\ell_1)\). A larger value means the unrestricted fit improves more over the restricted fit.

The null hypothesis states that the restrictions defining \(M_0\) hold; the alternative allows the additional parameters in \(M_1\) to vary. Under regularity conditions and when \(H_0\) is true, \(\Lambda\) is approximately distributed as a chi-square random variable with degrees of freedom equal to the number of independent restrictions. Thus the p-value is the right-tail probability \(P(\chi^2_{df}\geq\Lambda)\). This is an asymptotic approximation, not an exact finite-sample result.

Checks Before Doing the Arithmetic

The two fits must use the same observations and response data, and the smaller model must be obtainable from the larger by imposing restrictions. For example, setting a group coefficient to zero can define a nested fixed-effect comparison. Comparing two unrelated structural models does not create a likelihood ratio test merely because both models have reported likelihoods.

The likelihoods must also be on a comparable basis. Fixed-effect hypotheses are ordinarily compared using maximum likelihood (ML): restricted maximum likelihood (REML) likelihoods depend on the fixed-effect design, so REML likelihoods from fits with different fixed effects are not directly comparable. For a covariance-only comparison with exactly the same fixed-effect design, REML likelihoods may be compared when both fits use the same data and compatible REML definitions. Using ML for both models is another valid common basis.

The usual chi-square calibration requires regularity: the null parameter value is in the interior of the parameter space, parameters are identifiable, the models are correctly nested, and the likelihood is sufficiently well behaved for the large-sample approximation. A variance tested against zero is on a boundary, so it does not meet the ordinary interior-parameter condition; the standard chi-square degrees-of-freedom rule cannot automatically be applied. Boundary tests and their special reference distributions are a separate issue.

For a regular test, \(df\) counts independent constraints, not the total number of parameters in either model. Testing a three-coefficient block against zero gives three restrictions and hence \(df=3\), provided those restrictions are independent and the regularity conditions hold. Constraints that are redundant do not add degrees of freedom.

Worked Example: One Fixed-Effect Restriction

Suppose hypothetical ML fits use the same observations and differ only in whether a prespecified treatment coefficient is estimated. The reduced fit has \(-2\ell_0=812.6\); the full fit has \(-2\ell_1=806.4\). The null model sets the treatment coefficient to zero, and the full model estimates it.

The models are nested, and the fixed-effect comparison uses ML for both fits. There is one restriction, so \(df=1\). The statistic is $$ \Lambda=812.6-806.4=6.2. $$

The right-tail probability is \(P(\chi^2_1\geq6.2)\approx0.01276\). At \(\alpha=0.05\), this is evidence against the null restriction: the treatment coefficient improves the model's maximized likelihood enough to be statistically distinguishable from zero under the stated asymptotic test. This result alone does not establish a clinically important treatment effect; its magnitude and uncertainty should also be considered.

Degrees of Freedom and the Chi-Square Calculation

For nested models, let \(q\) denote the number of independent parameter restrictions imposed by \(M_0\) relative to \(M_1\). Under the regularity conditions, \(df=q\). If models have parameter dimensions \(k_0\) and \(k_1\), then \(q=k_1-k_0\) when the constraints are independent and the models differ only by those restrictions. The direct hypothesis description is safer than blindly subtracting software parameter counts, especially when parameterizations impose constraints or include parameters that are not freely estimated.

A short justification explains both the statistic and its degrees of freedom. The likelihood ratio is \(L_0/L_1\), where \(L_j\) is the maximized likelihood under model \(M_j\). Since the larger model includes the smaller, \(L_1\geq L_0\), and $$ -2\log(L_0/L_1)=2(\ell_1-\ell_0)=\Lambda\geq0. $$ Near the true parameter, a regular log likelihood is approximately quadratic in parameter deviations. Under \(H_0\), the \(q\) independent directions released by the larger model contribute a sum of \(q\) squared, approximately standard-normal components to this likelihood improvement. That sum has approximately a \(\chi^2_q\) distribution, which yields the right-tail p-value. The approximation depends on regularity and adequate information; it is not a guarantee for every small or weakly identified NLME data set.

Worked Example: Joint Test of Three Fixed Effects

In a hypothetical analysis, the reduced ML model omits three prespecified covariate effects, while the full model estimates all three. Both use the same subjects and observations. Their fit summaries are \(-2\ell_0=945.8\) and \(-2\ell_1=934.6\).

The three restrictions are independent, so \(df=3\). The likelihood ratio statistic is $$ \Lambda=945.8-934.6=11.2. $$ The p-value is \(P(\chi^2_3\geq11.2)\approx0.01069\). Since \(0.01069<0.05\), the joint null hypothesis that all three effects are zero is rejected at the 5% level. The test supports the conclusion that at least one of the three restrictions is inconsistent with the data under this model; it does not by itself identify which coefficient matters. That requires further estimation or suitably planned follow-up tests.

Testing a Regular Covariance Restriction

An LRT can also compare covariance structures, provided the null restriction is regular. For instance, when random-effect variances are positive, testing whether one covariance (or correlation) is zero can be an interior restriction: a zero correlation is allowed between \(-1\) and \(1\), and zero covariance is interior if the marginal variances remain positive. In that setting, a single independent restriction ordinarily gives one degree of freedom. This differs from testing a variance component equal to zero, which is a boundary hypothesis.

Worked Example: Testing a Random-Effect Correlation

Consider hypothetical ML fits with the same fixed effects and data. The reduced covariance model fixes the correlation between two random effects at zero; the alternative estimates that correlation. Both estimated random-effect variances are positive, and the fitted covariance matrices are valid. The reduced model has \(-2\ell_0=1204.7\), and the alternative has \(-2\ell_1=1200.7\).

There is one correlation restriction, and zero is an interior value for that correlation under the stated positive-variance conditions. Thus the regular chi-square approximation uses \(df=1\). The statistic is $$ \Lambda=1204.7-1200.7=4.0. $$ The p-value is \(P(\chi^2_1\geq4.0)\approx0.04550\). At the 5% level, the test rejects zero correlation under this model and approximation. It does not mean there is a 95% probability that the correlation is nonzero, nor does it establish that the estimated association is practically important.

Fit-Report Diagnostics and Common Pitfalls

Before interpreting a result, inspect the fit summaries and model specifications rather than relying only on a software p-value. Confirm the sample and likelihood basis, whether each fit converged, and whether the likelihood values are finite and consistent with the intended nesting. Numerical optimization can stop at a local or poorly optimized solution. Because the unrestricted model should have at least as large a maximized likelihood, \(\Lambda\) should not be negative. A negative difference, or a very small difference accompanied by unstable estimates, calls for checking convergence, parameter constraints, and data/model consistency rather than reporting a routine test.

Also check that the statistic and degrees of freedom match the actual null hypothesis. A block test uses the number of independent restrictions, not the number of coefficients that happen to appear in a model summary. If a categorical covariate has several levels, its joint test may involve multiple contrasts. If a parameter is nonidentifiable under the null, or a variance is constrained to be nonnegative and tested at zero, ordinary chi-square calibration can fail. In small or sparse data sets, even an interior-parameter test may have a poor asymptotic approximation.

A common mistake is to subtract REML likelihoods from two fits whose fixed-effect designs differ, then interpret the result as a fixed-effect LRT. The arithmetic may produce a number, but the REML likelihoods are not comparable for that purpose. The correction is to fit both nested fixed-effect models by ML using the same observations, then calculate the likelihood ratio statistic and its appropriate degrees of freedom.

The Wald test is a common alternative for fixed effects: it uses an estimate divided by its standard error, or a corresponding joint quadratic form. It can be convenient, but its approximation can be sensitive to parameterization and near-boundary or weakly identified estimates. The LRT compares fitted likelihoods and naturally tests a nested block, but also relies on regularity and adequate optimization. For non-nested models, a standard nested-model LRT is not the appropriate comparison; model-selection criteria address a different question and should not be substituted into the LRT formula.

Key takeaway: A defensible NLME likelihood ratio test needs more than a subtraction. Establish nesting and comparable likelihoods, compute \(\Lambda=(-2\ell_0)-(-2\ell_1)\), count independent restrictions, and use a chi-square reference only when its regularity assumptions are credible.

Check Your Understanding

Use these questions to check both the arithmetic and the conditions behind the test.

  1. Two nested ML fits have \(-2\ell_0=760.5\) and \(-2\ell_1=755.5\), with two independent restrictions. Find \(\Lambda\), \(df\), and the approximate p-value.
  2. Why should REML likelihoods not ordinarily be used to test a change in fixed effects?
  3. A test sets one random-effect variance to zero. Is the ordinary one-degree-of-freedom chi-square reference automatically justified? Why or why not?
  4. A more general nested fit reports a smaller maximized likelihood than the restricted fit. What should be checked before calculating a p-value?

Solutions. 1. \(\Lambda=760.5-755.5=5.0\), \(df=2\), and \(P(\chi^2_2\geq5.0)=e^{-5/2}\approx0.08208\); this is not significant at \(\alpha=0.05\). 2. REML likelihoods depend on the fixed-effect design, so changing that design changes the likelihood basis; use ML fits on the same data for the fixed-effect LRT. 3. No. A variance constrained to be nonnegative has zero on the parameter-space boundary, so the ordinary interior-parameter chi-square result does not automatically apply. 4. Check that the fits use the same data and comparable likelihood definition, are genuinely nested as specified, and have converged successfully; the larger model's maximized likelihood should not be lower.