Signature
LR = 2 * (ell_1 - ell_0); df = q_1 - q_0
| Inputs | Definition | Unit |
|---|---|---|
ell_1 | Maximised log-likelihood of the model with more free parameters | log-likelihood |
ell_0 | Maximised log-likelihood of the restricted model, fitted to the same data | log-likelihood |
q_1 | Number of free parameters in the larger model | count |
q_0 | Number of free parameters in the restricted model | count |
LR | Likelihood ratio statistic, twice the log-likelihood gain | none |
|---|---|---|
df | Difference in the number of free parameters between the two models | none |
Function
Chi-square distribution of a sum of squared standard normal deviates
Maps the degrees of freedom k to the distribution of the sum of k independent squared standard normal variables. Health economic models meet it as the reference for test statistics, each read from the right-hand tail: a likelihood ratio between nested survival models, Cochran's Q for heterogeneity in a meta-analysis and Pearson's statistic for calibration targets. It is the gamma distribution with shape k/2 and scale 2. The formulae for Cochran's Q, I-squared and the between-study variance are on the Aggregate Data Meta-Analysis page (HE-FM-ADMA-002 to HE-FM-ADMA-004). AIC and BIC, which TSD 14 prefers for choosing between survival curves, are on the Akaike Information Criterion page (HE-FM-AIC-001 and HE-FM-AIC-004) and the Bayesian Information Criterion page (HE-FM-BIC-001).
Computational function
Computational function: likelihood ratio test p-value and critical value from two fitted models
Takes the two fitted models' maximised log-likelihoods and parameter counts and a significance level, and returns the likelihood ratio statistic, its degrees of freedom, the p-value and the critical value. It applies HE-FM-CHISQ-006 and then evaluates the right-hand tail of chi-square, which for most degrees of freedom has no closed form: it is the regularised upper incomplete gamma function with shape df/2 at LR/2, computed numerically by Excel CHISQ.DIST.RT, R pchisq and Python scipy.stats.chi2.sf, while the critical value needs the numerical inverse. The inputs therefore differ from the formula's variables: the level alpha is extra, and the outputs include a p-value and a critical value that the formula cannot give.
Inputs and outputs:
ell_0,ell_1: Maximised log-likelihoods of the restricted and larger models, fitted to the same data; required. Unit: log-likelihood.;q_0,q_1: Numbers of free parameters, with q_1 above q_0; required. Unit: count.;alpha: Significance level; optional, default 0.05. Unit: probability.;LR: Likelihood ratio statistic. Unit: none.;df: Degrees of freedom. Unit: none.;p_value: Right-tail probability of LR on df degrees of freedom. Unit: probability.;x_crit: Critical value at level alpha. Unit: none.Assumption: The models are nested, the null value is not on the boundary of the parameter space and the sample is large, so that Wilks' theorem applies. Non-nested survival curves are compared with AIC and BIC instead.
Worked example (Weibull against exponential): The article's step 1: a statistic of 9.0 on one degree of freedom has a p-value of about 0.0027 against a critical value of 3.841.
ell_0 = -612.8; ell_1 = -608.3; q_0 = 1; q_1 = 2; alpha = 0.05; LR = 9.0; df = 1; p_value = 0.0027; x_crit = 3.8415Worked example (Generalised gamma against Weibull): The article's step 2: a statistic of 0.8 on one degree of freedom has a p-value of about 0.37.
ell_0 = -608.3; ell_1 = -607.9; q_0 = 2; q_1 = 3; alpha = 0.05; LR = 0.8; df = 1; p_value = 0.3711; x_crit = 3.8415Worked example (Generalised gamma against exponential): The article's step 3: a statistic of 9.8 on two degrees of freedom has a p-value of about 0.0074 against a critical value of 5.991.
ell_0 = -612.8; ell_1 = -607.9; q_0 = 1; q_1 = 3; alpha = 0.05; LR = 9.8; df = 2; p_value = 0.0074; x_crit = 5.9915Excel:
=CHISQ.DIST.RT(2*(LogLik1-LogLik0),Params1-Params0)returns the p-value and=CHISQ.INV.RT(Alpha,Params1-Params0)the critical value, with the log-likelihoods in LogLik1 and LogLik0 and the parameter counts in Params1 and Params0.R:
lr_test <- function(ll0, ll1, q0, q1, alpha = 0.05) { lr <- 2 * (ll1-ll0); df <- q1-q0; c(LR = lr, df = df, p_value = pchisq(lr, df, lower.tail = FALSE), x_crit = qchisq(alpha, df, lower.tail = FALSE)) }Base R;lr_test(-612.8, -608.3, 1, 2)returns the step 1 result.Python:
def lr_test(ll0, ll1, q0, q1, alpha=0.05): lr = 2 * (ll1-ll0); df = q1-q0; return dict(LR=lr, df=df, p_value=stats.chi2.sf(lr, df), x_crit=stats.chi2.isf(alpha, df))Needsfrom scipy import stats; chi2.sf is the right-tail probability and chi2.isf its inverse.Test (Two-degree-of-freedom result matches the closed form): With df equal to 2 the p-value equals exp(minus LR/2), HE-FM-CHISQ-003. Expected result: TRUE. Excel check:
=ABS(CHISQ.DIST.RT(9.8,2)-EXP(-9.8/2))<1E-12Test (One-degree-of-freedom result matches the two-sided normal tail): With df equal to 1 the p-value equals twice the normal tail beyond the square root of LR. Expected result: TRUE. Excel check:
=ABS(CHISQ.DIST.RT(9,1)-2*(1-NORM.S.DIST(SQRT(9),TRUE)))<1E-9Common error (Running the test on survival curves that are not nested): A Weibull and a log-logistic curve cannot be nested, so the function returns a number with no valid reference distribution. TSD 14 reports that the test has been used this way in past NICE technology appraisals and directs the comparison to AIC and BIC.
Source: Chen Y, Moustaki I, Zhang H. A note on likelihood ratio tests for models with latent variables. Psychometrika. 2020;85(4):996-1012. Section 1.1, on comparing the statistic with chi-square on the difference in the number of free parameters under regularity conditions. Microsoft. CHISQ.DIST.RT and CHISQ.INV.RT functions. Microsoft Support; accessed 2 October 2026, for the right-tailed probability and its inverse.
LR = 2 * (ell_1 - ell_0); df = q_1 - q_0; p_value = Q(df / 2, LR / 2); x_crit = Q^-1(alpha | df)
Try this function
Implementations
Excel
Likelihood ratio statistic and its degrees of freedom in two cells
With named cells LogLik1, LogLik0, Params1 and Params0, the formulas return the statistic and its degrees of freedom.
=2*(LogLik1-LogLik0); =Params1-Params0
Assumptions
Nested models for a chi-square likelihood ratio test
The restricted model is the larger one with some parameters fixed, as the exponential is the Weibull with its shape fixed at 1. TSD 14 states that different parametric survival models using different probability distributions cannot be nested within one another, so the test does not compare, for example, a Weibull with a log-logistic curve; for choosing between survival curves it points to AIC and BIC.
Null value away from the parameter boundary for the likelihood ratio test
When the null model lies on the boundary of the parameter space, as when testing whether a random-effects variance is zero, the regularity conditions of Wilks' theorem fail and the statistic often follows a mixture of chi-square distributions instead.
Same data and maximum likelihood fits for the likelihood ratio test
Both models are fitted by maximum likelihood to the same observations, and the sample is large enough for the chi-square approximation.
Worked examples
Weibull against exponential on the same trial arm
Illustrative log-likelihoods of minus 608.3 and minus 612.8 give a gain of 4.5 and a statistic of 9.0 on one degree of freedom, above the critical value of 3.841, with a p-value of about 0.0027.
ell_1 = -608.3; ell_0 = -612.8; q_1 = 2; q_0 = 1; LR = 9.0; df = 1
Generalised gamma against Weibull on the same trial arm
A gain of 0.4 gives a statistic of 0.8 on one degree of freedom and a p-value of about 0.37, so the third parameter adds nothing detectable within the trial data.
ell_1 = -607.9; ell_0 = -608.3; q_1 = 3; q_0 = 2; LR = 0.8; df = 1
Generalised gamma against exponential on the same trial arm
A gain of 4.9 gives a statistic of 9.8 on two degrees of freedom and a p-value of about 0.0074 from the closed form HE-FM-CHISQ-003.
ell_1 = -607.9; ell_0 = -612.8; q_1 = 3; q_0 = 1; LR = 9.8; df = 2
Common errors
Likelihood ratio test used to choose between non-nested survival curves
TSD 14 states that the negative 2 log likelihood is only suitable for comparing nested models and that it has been used erroneously in past NICE technology appraisals. A log-likelihood difference between a Weibull and a log-logistic curve has no chi-square reference.
Log-likelihood gain not doubled in a likelihood ratio test
Comparing the gain of 4.5 itself with chi-square on one degree of freedom gives a p-value of about 0.034 instead of 0.0027.
Sources
Likelihood ratio test degrees of freedom and boundary problems
Chen Y, Moustaki I, Zhang H. A note on likelihood ratio tests for models with latent variables. Psychometrika. 2020;85(4):996-1012. Abstract and sections 1.1 and 1.2: for nested models satisfying certain regularity conditions the statistic is compared with a chi-square distribution with degrees of freedom equal to the difference in the number of free parameters; at the boundary of the parameter space it often follows a mixture of chi-square distributions.
Nested survival models and the limits of the likelihood ratio test in TSD 14
Latimer N. NICE DSU Technical Support Document 14: survival analysis for economic evaluations alongside clinical trials, extrapolation with patient-level data. Sheffield: Decision Support Unit, ScHARR, University of Sheffield; 2011, last updated March 2013. Sections 2.2 and 2.6 on the exponential as a special case of the Weibull and the generalised gamma containing the Weibull, exponential and log normal; section 3.3, which states that the negative 2 log likelihood is only suitable for nested models and points to AIC and BIC.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0