Skip to main content
v2026.11,772 entries · CC-BY 4.0

Likelihood Ratio Test for Nested Models

A complete guide to the likelihood ratio test for comparing nested maximum-likelihood models: why the nesting requirement invalidates non-nested comparisons, how the chi-square test statistic is built from the -2 log-likelihood difference, degrees of freedom, the boundary problem for variance components in mixed models, and when to use an LRT versus AIC or BIC.

Written and maintained by CASRAI Editorial Board

Last updated

A likelihood ratio test (LRT) compares two statistical models fit by maximum likelihood to ask whether the extra parameters in the more complex model improve fit by more than chance would predict. It is one of the three classical tests built on maximum-likelihood estimation — alongside the Wald test and the score (Lagrange multiplier) test — and it is the one most commonly used to justify keeping or dropping predictors in logistic regression, Poisson regression, and other generalized linear models, as well as random-effects terms in mixed models.

The test only works under one condition that trips up a lot of otherwise-correct analyses: the two models being compared must be nested. This guide covers what nesting actually requires, how the chi-square test statistic is built from each model’s log-likelihood, how to read the degrees of freedom, where the chi-square approximation itself breaks down, and when AIC or BIC is the better tool instead.

The nesting requirement: why a non-nested comparison invalidates the test

Two models are nested when the simpler model (the reduced model) can be obtained from the more complex model (the full model) by fixing one or more of the full model’s parameters to specific values — almost always by constraining them to zero, which in practice means removing predictors, interaction terms, or random-effects variance components. Every parameter in the reduced model must appear in the full model, fit to the exact same data and the exact same outcome variable.

This is a strict requirement, not a loose one. A likelihood ratio test is not valid for comparing:

  • Two models with non-overlapping predictor sets — for example, a model predicting an outcome from age and income versus a model predicting it from education and region. Neither model’s parameter set is a subset of the other’s, so there is no valid reduced/full pairing.
  • Models fit to different samples or a different number of observations — a common, easy-to-miss violation when one model drops rows with missing data on a predictor the other model doesn’t include. The likelihoods are then not comparable, nested parameter structure or not.
  • Models with different outcome variables or different link functions in a way that changes what the likelihood is actually measuring — for instance, a logit model versus a probit model. Both might use the same predictors, but the models aren’t nested in the required sense because one can’t be reduced to the other by constraining parameters.
  • Models fit by different estimation methods where the likelihoods aren’t on a comparable scale — e.g., comparing a mixed model fit by full maximum likelihood (ML) against one fit by restricted maximum likelihood (REML) when the fixed-effects structure differs between them (REML likelihoods are only comparable across models with identical fixed effects).

When models aren’t nested, running an LRT anyway doesn’t fail loudly — software will typically still return a number. That number just doesn’t follow a chi-square distribution and isn’t testing a well-defined hypothesis. If you need to compare non-nested models, see the AIC/BIC section below instead.

Constructing the test statistic from −2 log-likelihood

Maximum likelihood estimation reports a log-likelihood (LL) value for each fitted model — how probable the observed data are under that model’s fitted parameters, on a log scale. Because the full model has at least as many free parameters as the reduced model, and each additional parameter can only help fit the observed data as well or better, the full model’s log-likelihood is always at least as large as the reduced model’s: LLfull ≥ LLreduced.

The likelihood ratio test statistic is built from twice that difference:

LR = −2(LLreduced − LLfull) = 2(LLfull − LLreduced)

Because most statistical software reports −2LL (sometimes called the deviance) rather than LL directly, the more commonly used form is simply the difference of the two −2LL values:

LR = (−2LLreduced) − (−2LLfull)

Both forms give the same number. LR is always ≥ 0, since the full model can never fit worse than the reduced model it contains — a negative LR is a sign of a model-fitting or nesting error, not a valid result.

The chi-square reference distribution and degrees of freedom

Under the null hypothesis that the reduced model is correct (i.e., the extra parameters in the full model are genuinely zero in the population) and under standard regularity conditions, LR is asymptotically distributed as a chi-square random variable. This result is generally attributed to Wilks (1938) and is often called Wilks’ theorem.

The degrees of freedom for that chi-square distribution equal the difference in the number of estimated parameters between the two models — in practice, the number of parameters set to zero (removed) going from the full model to the reduced model. Compare LR against the chi-square distribution with that many degrees of freedom to get a p-value: reject the reduced model in favor of the full model when LR exceeds the relevant critical value (or, equivalently, when the resulting p-value falls below your chosen significance threshold).

Illustrative example (not real data): Suppose a researcher fits a logistic regression predicting treatment response from a baseline model with two predictors (age, baseline severity), then adds two more predictors (a treatment-by-severity interaction and a site indicator). The baseline (reduced) model reports −2LL = 412.6 with 3 estimated parameters (intercept + 2 predictors); the expanded (full) model reports −2LL = 401.8 with 5 estimated parameters. LR = 412.6 − 401.8 = 10.8, with df = 5 − 3 = 2. Compared against a chi-square distribution with 2 df, LR = 10.8 corresponds to p ≈ 0.0045 — the added predictors improve fit by significantly more than would be expected by chance, so the full model is preferred.

Where the chi-square approximation itself breaks down

Wilks’ theorem is an asymptotic result, and it assumes the parameter being tested isn’t constrained to a boundary of its allowed range. That assumption fails in one setting that comes up constantly in applied work: testing whether a variance component in a mixed-effects (multilevel/hierarchical) model equals zero — for example, testing whether a random intercept or random slope is needed at all.

A variance can’t be negative, so the null value being tested (variance = 0) sits exactly on the boundary of the parameter space rather than in its interior. Under that condition, the standard chi-square reference distribution used above is no longer correct: the true asymptotic distribution of the LR statistic is a mixture of chi-square distributions (rather than a single chi-square with the “usual” degrees of freedom), and naively applying the textbook chi-square test in this situation makes the p-value too conservative for a single boundary parameter and can be badly wrong when multiple variance components are tested jointly. This boundary problem is well documented in the mixed-models literature; some software (e.g. certain lme4/lmerTest workflows in R) offers a corrected mixture-distribution p-value or a parametric-bootstrap LRT specifically to work around it. If you’re testing a random-effects variance term rather than a fixed-effect coefficient, don’t assume the plain chi-square LRT above applies without checking how your software handles this case.

LRT vs. AIC and BIC: when to use which

All three tools use the same underlying log-likelihood, but they answer different questions and apply in different situations:

  • Use the LRT when you have exactly two specific, nested models and want a formal hypothesis test with a p-value — e.g., “does adding this interaction term significantly improve fit over the model without it?” It requires nesting and a chosen significance threshold, and it doesn’t directly generalize to comparing more than two models at once.
  • Use AIC or BIC when you’re comparing several candidate models (nested or not) and want to rank them by a penalized-fit criterion rather than run a series of pairwise significance tests. AIC = −2LL + 2k and BIC = −2LL + k·ln(n), where k is the number of estimated parameters and n is the sample size; the model with the lower value is preferred. Neither requires nesting, and neither produces a p-value or a formal reject/fail-to-reject decision — they rank models on an information-theoretic (AIC) or approximate-Bayesian (BIC) fit/complexity trade-off instead. BIC’s heavier penalty on additional parameters (via ln(n), which grows with sample size) tends to favor smaller models than AIC does as n gets large.

In practice, many analyses report both: an LRT to formally test a specific, theory-driven nested comparison (does this one term belong in the model), and AIC/BIC alongside it when the underlying question is broader model selection across several non-nested candidates.

Running it in common software

The mechanics are the same everywhere — fit both models, difference their −2LL (or double the LL difference), compare to chi-square — but most packages automate it directly rather than requiring you to pull the log-likelihoods out by hand:

  • R: anova(reduced_model, full_model, test = "Chisq") for glm/lm objects; for mixed models fit with lme4, anova(reduced_model, full_model) on two lmer/glmer fits (refit with ML, not REML, if comparing fixed effects).
  • Stata: fit both models, storing each with estimates store, then run lrtest reduced_model full_model.
  • SPSS: the −2 log likelihood values for each block appear in the regression output directly; subtract them and evaluate against the chi-square distribution with the corresponding df, or use the “Omnibus Tests of Model Coefficients” table, which already runs this calculation for successive blocks.

Frequently asked questions

Can I use a likelihood ratio test to compare a linear regression and a logistic regression?

No. Those models have different outcome distributions and different likelihood functions on a different scale, so they can never be nested in the required sense — there is no way to reduce one to the other by constraining parameters. Compare them, if genuinely needed, using a fit measure appropriate to each model type separately, not a single LRT.

What does it mean if my likelihood ratio test statistic comes out negative?

It means something is wrong with the comparison — most often that the two models weren’t actually fit to identical data (a different number of rows due to missingness on a predictor unique to one model), or that the “full” and “reduced” labels were reversed. A correctly nested LRT run on identical data cannot produce a negative statistic.

Is the likelihood ratio test the same as a chi-square goodness-of-fit test?

No, though both use the same reference distribution. A chi-square goodness-of-fit test compares observed category counts to expected counts under a single hypothesized distribution. An LRT compares the fit of two nested maximum-likelihood models to each other. They’re different tests that happen to share a chi-square reference distribution for unrelated reasons.

How many models can I compare with one likelihood ratio test?

Exactly two at a time — one specific reduced model against one specific full model that contains it. Comparing a sequence of nested models (e.g., adding one predictor at a time) requires a separate LRT at each step, or an information criterion like AIC/BIC to rank the whole set at once.

For the underlying distribution theory referenced above, see CASRAI’s guide to the chi-square test and its entry on degrees of freedom. For the broader landscape of significance testing this fits into, see CASRAI’s guide to what a p-value measures and the dictionary entries for statistical test and effect size. Model comparison via the LRT comes up most often alongside logistic regression and its R implementation, where the technique is used routinely to test individual predictors and interaction terms.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · included with Regulatory Radar

Ask about Likelihood Ratio Test for Nested Models

Ask CASRAI answers research-administration questions and cites the passages behind every claim — and says so when the corpus does not cover something, instead of guessing. It comes with a Regulatory Radar subscription at $29 a month, alongside the daily digest of regulatory changes and the dashboard of what changed.

150 questions a day, on this site, over the API, or inside your own tools through the CASRAI MCP server.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Regulatory Radar

Stop finding out after the fact

$29/month, cancel anytime. Daily digest updates from our analysis, a dashboard holding the same items, and a cited assistant for everything they raise.

  • Federal Register, Federal Register+, Grants.gov, Regulations.gov, NSF News, UKRI, plus CASRAI’s own published content.
  • 72,264 indexed passages, and every answer cites the ones it drew on.