Chi-square probability density with k degrees of freedom

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.

Signature

f_x = x^(k/2 - 1) * exp(-x / 2) / (2^(k/2) * Gamma(k/2))
Inputs
InputsDefinitionUnit
xValue of the chi-square variable, above zero, for example an observed test statisticnone
kDegrees of freedom, above zero; the number of squared standard normal terms in the sumnone
Output
f_xProbability density of the chi-square distribution at xper unit of x

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

Implementations

  • Excel

    Chi-square density in one cell

    With named cells Stat and DegFree, CHISQ.DIST with FALSE as its last argument returns the density. Excel truncates a degrees of freedom argument that is not a whole number.

    =CHISQ.DIST(Stat,DegFree,FALSE)

Assumptions

  • Independent standard normal terms behind the chi-square density

    The variable is a sum of k independent squared standard normal deviates. A test statistic follows the distribution only approximately, in large samples and under the null hypothesis, so the density describes the reference distribution rather than the exact behaviour of the statistic.

Worked examples

  • Chi-square density at 2 on two degrees of freedom

    With k = 2 the gamma term is one and the density at 2 is one half of exp(minus 1), about 0.1839.

    x = 2; k = 2; f_x = 0.1839
  • Chi-square density at 1 on one degree of freedom

    Gamma(1/2) is the square root of pi, so the density at 1 is exp(minus 0.5) divided by the square root of 2 pi, about 0.2420.

    x = 1; k = 1; f_x = 0.2420

Common errors

  • Reading the chi-square density as a p-value

    The density at the observed statistic is not a probability. For the Weibull against exponential statistic of 9.0 on one degree of freedom the density is about 0.0015, whereas the p-value, the area of the right-hand tail, is about 0.0027.

Sources

  • Chi-square density, mean and variance in the R documentation

    R Core Team. The (non-central) chi-squared distribution: Chisquare, package stats. R Documentation; accessed 2 October 2026. Details: the chi-squared distribution with n degrees of freedom has density 1/(2^(n/2) Gamma(n/2)) x^(n/2 minus 1) e^(minus x/2) for x above zero, with mean n and variance 2n.

    View source →

  • Chi-square as a special case of the gamma distribution in SciPy

    SciPy developers. scipy.stats.chi2. SciPy v1.18.0 Manual; accessed 2 October 2026. Notes: the chi-squared distribution is a special case of the gamma distribution, with shape df/2, location 0 and scale 2.

    View source →

Canonical Identity

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