Author-reviewedEvidence: highv1.0.2

Chi-Square Distribution

The chi-square distribution describes a sum of squared independent standard normals and is the reference for likelihood ratio, heterogeneity and fit tests.

Download concept guide
Last reviewed byDr Darrin Baines

Concept Architecture

Chi-Square Distribution as the Reference for Likelihood Ratio, Heterogeneity and Fit Tests

Health economists rarely fit a chi-square distribution to data. They meet it as the yardstick against which test statistics are judged, for example the gain in log-likelihood when a survival curve gains a parameter, the spread of trial results in a meta-analysis, or the gap between model predictions and calibration targets. The distribution is built from squared normal deviations and is a special case of the gamma distribution, and its degrees of freedom are counted differently in each of those uses.

Building the distribution from squared normal deviations

The chi-square distribution describes what happens when independent standard normal deviations are squared and added up. Each squared deviation is non-negative, so the total can never fall below zero, and adding more terms moves the distribution to the right and spreads it out. The number of terms is the single parameter, the degrees of freedom, as follows.

X=∑i=1kZi2∼χk2X = \sum_{i=1}^{k} Z_i^2 \sim \chi^2_k

where XX is the chi-square variable, Z1,…,ZkZ_1, \dots, Z_k are independent standard normal variables and kk is the degrees of freedom. The density for x>0x > 0 is given below.

f(x;k)=12k/2 Γ(k/2) xk/2−1 e−x/2f(x; k) = \frac{1}{2^{k/2}\,\Gamma(k/2)}\, x^{k/2 - 1}\, e^{-x/2}

where f(x;k)f(x; k) is the probability density at xx, Γ\Gamma is the gamma function and kk is the degrees of freedom. The mean is E(X)=kE(X) = k and the variance is Var(X)=2k\mathrm{Var}(X) = 2k, so a statistic that follows χk2\chi^2_k when the null hypothesis holds has expected value kk. A value far above kk is what produces a small p-value, and every chi-square test on this page reads its p-value from the right-hand tail.

Links to the normal and gamma distributions

With one degree of freedom the chi-square distribution is the distribution of a single squared normal deviate. That is why a two-sided test at the 5% level based on a normal z statistic and a chi-square test on one degree of freedom give the same answer, because the squared normal critical value, z2=1.962=3.8416z^2 = 1.96^2 = 3.8416, matches the 95th percentile of χ12\chi^2_1, which is 3.841. A Wald test of one parameter can therefore be reported either as a z statistic or as its square.

The chi-square distribution is also a special case of the gamma distribution, with shape k/2k/2 and scale 2. When k=2k = 2 the shape is 1 and the gamma reduces to an exponential distribution with mean 2, so the right-tail probability has a closed form.

P(χ22>x)=e−x/2P(\chi^2_2 > x) = e^{-x/2}

where P(χ22>x)P(\chi^2_2 > x) is the probability that a chi-square variable with two degrees of freedom exceeds xx. The 5% critical value on two degrees of freedom is therefore −2ln⁡(0.05)=5.991-2\ln(0.05) = 5.991. As kk grows, the skewness, 8/k\sqrt{8/k}, falls towards zero, and because the variable is a sum of kk independent terms the central limit theorem makes it close to a normal distribution with the same mean and variance.

Likelihood ratio tests between nested survival models

In health economic modelling, the chi-square distribution is often met through the likelihood ratio test. Two models are nested when one is the other with some parameters fixed, and the test asks whether freeing those parameters improves the fit by more than chance. The statistic is twice the gain in maximised log-likelihood.

LR=2(ℓ1−ℓ0)LR = 2\left(\ell_1 - \ell_0\right)

where LRLR is the likelihood ratio statistic, ℓ1\ell_1 is the maximised log-likelihood of the larger model and ℓ0\ell_0 is that of the restricted model. Under Wilks' theorem, in large samples, under the null model and provided certain regularity conditions hold, LRLR is compared with a chi-square distribution whose degrees of freedom equal the difference in the number of free parameters.

Among parametric survival models, standard statistical theory treats the exponential as the Weibull with its shape fixed at 1, and the generalised gamma as a three-parameter model that contains the Weibull, exponential and log normal as special cases. The NICE Decision Support Unit's Technical Support Document 14 (TSD 14) describes the same special cases in its sections on each distribution, but it does not recommend likelihood ratio tests for choosing a survival curve. Its section on fit statistics states that the negative 2 log likelihood is only suitable for comparing nested models, that different parametric models using different probability distributions cannot be nested within one another, and that the test is therefore not suitable for assessing the fit of alternative parametric models and has been used erroneously in past NICE technology appraisals. For the statistical comparison of survival curves, TSD 14 points instead to the Akaike information criterion and the Bayesian information criterion, which allow models that are not nested and penalise extra parameters. The nested tests in the worked example below are therefore shown as standard statistics, not as the curve-selection method TSD 14 sets out.

Cochran's Q and heterogeneity in meta-analysis

When trial results are pooled to give a model's treatment effect, the chi-square distribution supplies the test for heterogeneity. Cochran's Q sums each study's weighted squared deviation from the pooled estimate, and its p-value comes from a chi-square distribution with k−1k - 1 degrees of freedom, where kk here is the number of studies. The formulas for Q, I-squared and the between-study variance are set out on the aggregate data meta-analysis page and are not repeated here.

The chi-square reading has a known weakness. Higgins and colleagues note that the test is poor at detecting true heterogeneity when studies are few, and the Cochrane Handbook warns that a non-significant result must not be taken as evidence of no heterogeneity, which is why a significance level of 0.10 rather than 0.05 is sometimes used. With many studies the test has the opposite problem and detects small amounts of between-study heterogeneity that may not matter clinically.

Goodness of fit when calibrating decision models

Calibration adjusts uncertain model parameters until model outputs agree with observed targets such as incidence or prevalence by age. Each candidate parameter set needs a score for how far its outputs sit from the targets. For counts, Pearson's statistic is one such score.

X2=∑j=1m(Oj−Ej)2EjX^2 = \sum_{j=1}^{m} \frac{(O_j - E_j)^2}{E_j}

where X2X^2 is the Pearson statistic, OjO_j is the observed count for target jj, EjE_j is the count predicted by the model for that target and mm is the number of targets. Each squared gap is scaled by the predicted count, so a gap of 7 cases matters more for a target of 45 than for a target of 450.

In a summary of options for calibration, Enns and colleagues list chi-squared alongside likelihood and log-likelihood as probabilistic measures of fit to individual targets, with absolute or squared difference and mean squared error as distance measures. Karnon and Vanni compared measures in probabilistic calibration and found that the chi-squared measure separated parameter sets by accuracy to a far greater degree than a likelihood measure. When the statistic is read against a chi-square distribution, as in a formal goodness of fit test, the NIST/SEMATECH handbook reduces the degrees of freedom for each parameter estimated from the same counts and asks for expected counts of at least 5 in each bin.

Worked example with three survival curves, one heterogeneity test and one calibration score

The figures below are illustrative. A modelling team fits exponential, Weibull and generalised gamma curves to progression-free survival in one trial arm, obtaining maximised log-likelihoods of -612.8, -608.3 and -607.9 with one, two and three parameters.

1. Weibull against exponential. The models differ by one parameter, so the reference is χ12\chi^2_1, as follows.

LRW,E=2×(−608.3−(−612.8))=2×4.5=9.0LR_{W,E} = 2 \times (-608.3 - (-612.8)) = 2 \times 4.5 = 9.0

where LRW,ELR_{W,E} is the likelihood ratio statistic for the Weibull against the exponential. The value exceeds the critical value of 3.841, and because 9.0=3.0\sqrt{9.0} = 3.0 the p-value equals the two-sided normal tail beyond 3, about 0.0027. The constant hazard of the exponential is rejected.

2. Generalised gamma against Weibull. One further parameter gives the following.

LRG,W=2×(−607.9−(−608.3))=2×0.4=0.8LR_{G,W} = 2 \times (-607.9 - (-608.3)) = 2 \times 0.4 = 0.8

where LRG,WLR_{G,W} is the statistic for the generalised gamma against the Weibull. On one degree of freedom the p-value is about 0.37, so the third parameter adds nothing detectable within the trial data.

3. Generalised gamma against exponential. Two parameters separate these models, so the closed-form tail applies.

P(χ22>9.8)=e−9.8/2=e−4.9=0.0074P(\chi^2_2 > 9.8) = e^{-9.8/2} = e^{-4.9} = 0.0074

where 9.8 is twice the log-likelihood gain of 4.9. Taken together, the three tests favour the Weibull among the nested candidates. They say nothing about a log-logistic or log normal alternative compared with the Weibull, and nothing about the plausibility of the extrapolated tail; in an appraisal, TSD 14 would direct the statistical comparison of all candidate curves to AIC and BIC.

4. Heterogeneity of the pooled effect. The illustrative three-trial example on the aggregate data meta-analysis page gives Q=6.867Q = 6.867 on 2 degrees of freedom. Using the same closed form, the p-value is e−3.4335=0.032e^{-3.4335} = 0.032, below both 0.05 and the more lenient 0.10, so the chi-square test agrees with the high I-squared reported there.

5. Scoring a calibrated model. A cancer model with two calibrated parameters predicts 45, 88, 112 and 105 new cases in four age bands where 52, 81, 120 and 97 were observed, as follows.

X2=(52−45)245+(81−88)288+(120−112)2112+(97−105)2105=1.089+0.557+0.571+0.610=2.827X^2 = \frac{(52-45)^2}{45} + \frac{(81-88)^2}{88} + \frac{(120-112)^2}{112} + \frac{(97-105)^2}{105} = 1.089 + 0.557 + 0.571 + 0.610 = 2.827

where each term is one age band's scaled squared gap. A second parameter set predicting 50, 85, 125 and 90 scores 0.080 + 0.188 + 0.200 + 0.544 = 1.012 with the terms rounded (1.013 unrounded) and would be ranked ahead. Read against χ42\chi^2_4, which treats the four counts as independent with expectations fixed in advance, the first set's p-value would be about 0.59. Both sets total 350, the same as the observed counts, and both parameters were tuned to these targets, so applying the NIST/SEMATECH rule of subtracting the estimated parameters plus one leaves a single degree of freedom and a p-value of about 0.09. The same score gives very different p-values under two defensible counts of degrees of freedom, which is why it is better used to rank candidate sets than as a formal test.

Computing tail probabilities in Excel and R

Model work needs two operations, a right-tail probability for an observed statistic and a critical value for a chosen level. In Excel, CHISQ.DIST.RT(9, 1) returns about 0.0027, the p-value in step 1, and CHISQ.INV.RT(0.05, 1) returns 3.841. Microsoft's documentation states that a non-integer degrees of freedom argument is truncated, whereas R's pchisq(9, df = 1, lower.tail = FALSE) accepts non-integer degrees of freedom.

Where the chi-square reference breaks down

The chi-square reference for a test statistic is a large-sample approximation that assumes a regular model, and several common health economic situations breach those conditions. The result is a p-value that looks exact but is not.

  • Parameters on a boundary. Chen and colleagues explain that 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. They list random effects and finite mixture models among the cases where the plain approximation often does not hold.
  • Models that are not nested. A log-likelihood difference between a Weibull and a log-logistic curve has no chi-square reference.
  • Sparse counts. Pearson's approximation needs adequate expected counts, and the NIST/SEMATECH handbook advises that bins with counts below 5 may need to be combined.
  • Significance is not adequacy. A non-significant likelihood ratio or heterogeneity test does not show that the simpler model is right, and, as the Cochrane Handbook notes for heterogeneity, a test with high power can flag differences too small to matter. TSD 14 separates fit to observed trial data from the external validity of an extrapolation, which no chi-square test addresses.
  • Degrees of freedom after calibration. When parameters are searched over many candidate sets against the same targets, the number of degrees of freedom used up is unclear, so a chi-square p-value for a calibrated model should be treated as descriptive.

Sources

  • Chen Y, Moustaki I, Zhang H. A note on likelihood ratio tests for models with latent variables. Psychometrika. 2020;85(4):996-1012.
  • Deeks JJ, Higgins JPT, Altman DG, McKenzie JE, Veroniki AA (editors). Chapter 10: Analysing data and undertaking meta-analyses. In: Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane; 2024. Section 10.10.2.
  • Enns EA, Cipriano LE, Simons CT, Kong CY. Identifying best-fitting inputs in health-economic model calibration: a Pareto frontier approach. Medical Decision Making. 2015;35(2):170-182.
  • Higgins JPT, Thompson SG, Deeks JJ, Altman DG. Measuring inconsistency in meta-analyses. BMJ. 2003;327(7414):557-560.
  • Karnon J, Vanni T. Calibrating models in economic evaluation: a comparison of alternative measures of goodness of fit, parameter search strategies and convergence criteria. PharmacoEconomics. 2011;29(1):51-62.
  • Latimer N. NICE DSU Technical Support Document 14: Survival analysis for economic evaluations alongside clinical trials, extrapolation with patient-level data. Decision Support Unit; 2011, last updated March 2013. Sections 2.2, 2.6, 3.3 and 3.5.
  • Microsoft. CHISQ.DIST.RT function and CHISQ.INV.RT function. Microsoft Support, Excel documentation. Accessed 2026.
  • NIST/SEMATECH. e-Handbook of Statistical Methods. Sections 1.3.5.15 (chi-square goodness-of-fit test), 1.3.6.6.6 (chi-square distribution) and 1.3.6.6.11 (gamma distribution). National Institute of Standards and Technology. Accessed 2026.
  • R Core Team. The (non-central) chi-squared distribution: Chisquare, package stats. R Documentation. Accessed 2026.
  • SciPy developers. scipy.stats.chi2. SciPy v1.18.0 Manual. 2026.

Institutional Perspectives (1)

  • PBAC

    Chi-Square Test for Heterogeneity Reported With Every Meta-Analysis

    For meta-analyses of trial results, the PBAC Guidelines ask submissions to report the extent of statistical heterogeneity using the Cochran Q statistic, its degrees of freedom, the chi-square test for heterogeneity and the I-squared statistic with its 95% uncertainty interval. The example results table places the chi-square (Q) value, degrees of freedom and P value beside each pooled estimate. Group-level trial data are pooled with a DerSimonian-Laird random effects model, and any other method must be explained and justified.

    Guidelines for preparing a submission to the Pharmaceutical Benefits Advisory Committee, version 5.0 (September 2016), subsection 2.6.2 and Table 2.6.2View source →

Functions & Formulae (7)

X = sum_(i=1)^k [Z_i^2], X ~ chi^2_k

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).

  • Chi-square probability density with k degrees of freedom

    f_x = x^(k/2 - 1) * exp(-x / 2) / (2^(k/2) * Gamma(k/2))

    Gives the density of the chi-square distribution at a value x above zero. Gamma(.) is the gamma function, which equals (m minus 1)! for a whole number m and the square root of pi at one half. With k = 2 the density reduces to one half of exp(minus x/2), the exponential density with mean 2.

  • Mean, variance and skewness of a chi-square distribution

    E_X = k; V_X = 2 * k; g_X = sqrt(8 / k)

    A statistic that follows chi-square on k degrees of freedom under the null hypothesis has expected value k, so only values well above k give small p-values. The skewness falls towards zero as k grows, and because the variable is a sum of k independent terms the central limit theorem makes it close to a normal distribution with the same mean and variance. The function sqrt is the square root.

  • Right-tail probability of a chi-square statistic on two degrees of freedom

    P_2 = exp(-x / 2)

    With k = 2 the chi-square distribution is exponential with mean 2, so the p-value for an observed statistic has a closed form. It gives the p-value for the generalised gamma against the exponential, which differ by two parameters, and for Cochran's Q from three studies in the article's worked example. The function exp is the exponential function.

  • One-degree-of-freedom chi-square statistic as a squared normal deviate

    X_1 = z^2

    With one degree of freedom the chi-square variable is a single squared standard normal deviate, so a two-sided normal test at a given level and a chi-square test on one degree of freedom give the same answer. A Wald test of one parameter can be reported as z or as its square, and the p-value of a one-degree-of-freedom statistic equals the two-sided normal tail beyond its square root.

  • Likelihood ratio statistic and chi-square degrees of freedom for nested models

    LR = 2 * (ell_1 - ell_0); df = q_1 - q_0

    The likelihood ratio statistic is twice the gain in maximised log-likelihood when the parameters fixed in the restricted model are freed. Under Wilks' theorem, in large samples, under the null model and when certain regularity conditions hold, LR is compared with chi-square on df degrees of freedom, the difference in the number of free parameters. The p-value is the right-hand tail, from the computational function below or, when df is 2, from HE-FM-CHISQ-003.

  • Pearson chi-square score for model calibration targets with its degrees of freedom

    X2 = sum_(j=1)^m [(O_j - E_j)^2 / E_j]; df = m - c - 1

    Scores a candidate parameter set by scaling each squared gap between an observed count and the model's predicted count by the predicted count, so a gap of 7 cases matters more for a target of 45 than for one of 450. When the score is read against chi-square, the NIST/SEMATECH rule subtracts the number of parameters estimated from the same counts, plus one, from the number of targets, which gives df. The one is subtracted because the predicted counts are constrained to add to the observed total, as in the article's example where both parameter sets total 350, the same as the observed counts. Treating the counts as independent with expectations fixed in advance gives m degrees of freedom instead, and the article's example shows how far the two readings can differ.

View all formulae

Library

Publications

4
  • Journal article

    Calibrating models in economic evaluation: a comparison of alternative measures of goodness of fit, parameter search strategies and convergence criteria — Karnon J, Vanni T, Vol. 29, No. 1, pp. 51-62 ed., 2011 (PharmacoEconomics)

    Study comparing goodness-of-fit measures, parameter search strategies and convergence criteria for calibrating models in economic evaluation, which found in probabilistic calibration that the chi-squared measure differentiated between parameter sets to a far greater degree than the likelihood measure.

  • Journal article

    Identifying best-fitting inputs in health-economic model calibration: a Pareto frontier approach — Enns EA, Cipriano LE, Simons CT, Kong CY, Vol. 35, No. 2, pp. 170-182 ed., 2015 (Medical Decision Making)

    Paper on a Pareto frontier approach to model calibration, cited for its summary table of fit measures, which lists chi-squared and likelihood as probabilistic measures and absolute or squared difference and mean squared error as distance measures.

  • Journal article

    A note on likelihood ratio tests for models with latent variables — Chen Y, Moustaki I, Zhang H, Vol. 85, No. 4, pp. 996-1012 ed., 2020 (Psychometrika)

    Paper on likelihood ratio tests for models with latent variables, noting that the chi-square approximation from Wilks' theorem often fails for random effects and finite mixture models and when testing at the boundary of the parameter space, where the statistic often follows a mixture of chi-square distributions.

  • Book

    Statistical Analysis of Cost-Effectiveness Data — Willan & Briggs, 1st Edition ed., 2006 (John Wiley & Sons)

    A synthesis of statistical methods for analysing cost-effectiveness data, including net-benefit regression, confidence intervals for the ICER, cost-effectiveness acceptability curves, and covariate adjustment. Part of the Wiley Statistics in Practice series.

Tools & Resources

3
  • Other

    The (non-central) chi-squared distribution: Chisquare, package stats — R Core Team, R Documentation, accessed 1 October 2026 ed., 2026 (R Core Team)

    Documentation for the chi-squared distribution functions in the R stats package, giving the density, a mean of n and variance of 2n, allowing non-integer degrees of freedom and returning upper-tail probabilities when lower.tail is FALSE.

  • Other

    CHISQ.DIST.RT function and CHISQ.INV.RT function — Microsoft, Microsoft Support, Excel documentation, accessed 1 October 2026 ed., 2026 (Microsoft)

    Documentation for the Excel CHISQ.DIST.RT and CHISQ.INV.RT functions, which return the right-tailed probability of the chi-squared distribution and its inverse and truncate a non-integer degrees of freedom argument.

  • Other

    scipy.stats.chi2 — SciPy developers, SciPy v1.18.0 Manual, accessed 1 October 2026 ed., 2026 (SciPy)

    Documentation for the SciPy chi-squared distribution, which gives its density and notes that it is a special case of the gamma distribution with shape df/2, location 0 and scale 2.

Frequently Asked Questions (6)

  • What is the chi-square distribution?

    The chi-square distribution describes a sum of squared independent standard normals and is the reference for likelihood ratio, heterogeneity and fit tests.

    Source: NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.6.6.6

  • What role does the chi-square distribution play in statistical tests?

    The chi-square distribution arises from summing squared standard normal variables, and it provides the reference against which several common tests are judged. When a test statistic measuring the discrepancy between observed and expected counts is computed, its value is compared with this distribution to see how surprising it would be under the null hypothesis. Tests of goodness of fit and of association in contingency tables rely on it in just this way. Supplying the yardstick for such tests is its role. Kirkwood and Sterne (2003) describe this distribution.

    Source: Kirkwood & Sterne 2003

  • How is the chi-square distribution used?

    The chi-square distribution is used as the reference distribution for tests whose statistics follow it, including the chi-square goodness-of-fit test, which compares observed with expected frequencies; the chi-square test of independence in contingency tables; and likelihood ratio tests. The test statistic is compared with the chi-square distribution to obtain a p-value. So the chi-square distribution is used to assess whether observed data depart from what a hypothesis predicts, by referring a computed statistic to the distribution with the appropriate degrees of freedom, which is why it is central to categorical data analysis and to a variety of other tests in statistics.

    Source: Pearson 1900

  • What are degrees of freedom in the chi-square distribution?

    Degrees of freedom in the chi-square distribution are the parameter determining its shape, corresponding to the number of independent squared standard normal variables summed, or in tests to the number of independent pieces of information underlying the statistic. More degrees of freedom make the distribution less skewed and shift it rightward. So degrees of freedom define which chi-square distribution applies, and in tests they are derived from the structure of the data, such as the number of categories minus constraints, which is why identifying the correct degrees of freedom is necessary for referring a test statistic to the right chi-square distribution and obtaining a valid p-value.

    Source: Pearson 1900

  • What tests rely on the chi-square distribution?

    Tests relying on the chi-square distribution include the chi-square goodness-of-fit test, assessing whether observed frequencies match expected ones; the chi-square test of independence or association in contingency tables; likelihood ratio tests, whose statistics are approximately chi-square in large samples; and tests concerning variances. So a range of tests rely on the chi-square distribution as the reference for their statistics, particularly those involving categorical data and comparisons of observed with expected counts, which makes the distribution important in the analysis of frequencies and associations and in the large-sample testing of models through likelihood ratio statistics.

    Source: Pearson 1900

  • What are the properties of the chi-square distribution?

    The chi-square distribution takes only non-negative values, is right-skewed, and has a shape determined by its degrees of freedom, becoming more symmetric and approaching normality as the degrees of freedom increase. Its mean equals its degrees of freedom. So the chi-square distribution's properties include non-negativity, right skew that lessens with more degrees of freedom, and a mean equal to the degrees of freedom, and these characteristics, together with its origin as a sum of squared standard normals, explain its role as the reference distribution for tests based on squared deviations and on likelihood ratios.

    Source: Pearson 1900

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 10 Oct 2026

Content version: 1.0.2

Canonical Identity

Term code
HE-ES-SA-024
Wikidata
Q243462

Stable URI · Machine-readable · Resolvable · CC BY 4.0