Calculator

Chi-Square Distribution Calculator Online

Calculate density, cumulative probability and quantiles of the chi-square distribution for statistical tests.

Settings

Calculator focused on this distribution.

Result and visualization

Calculate PDF/PMF, CDF and percentiles instantly.

Result pending…

Explanation

The chi-square distribution with \( k \) degrees of freedom arises from summing the squares of \( k \) independent standard normal variables: \( \chi^2_k = Z_1^2 + Z_2^2 + \cdots + Z_k^2 \). It only takes positive values, its mean is \( k \) and its variance is \( 2k \). With few degrees of freedom the distribution is strongly right-skewed; as \( k \) grows it approaches a normal distribution with mean \( k \) and standard deviation \( \sqrt{2k} \).

It is used in three main contexts of statistical inference: (1) goodness-of-fit tests, where the statistic measures how much the observed frequencies differ from the expected ones under a theoretical model; (2) independence tests in contingency tables, assessing whether two categorical variables are associated; and (3) inference about variances, where \( (n-1)S^2/\sigma^2 \) follows a chi-square distribution with \( n-1 \) degrees of freedom and allows building confidence intervals and tests for the population variance in normal samples.

Formula

\( f(x;k)=\frac{1}{2^{k/2}\Gamma(k/2)}x^{k/2-1}e^{-x/2},\quad x>0 \)

Parameters

  • k (degrees of freedom): determines the shape and spread of the distribution.
  • x: observed value of the chi-square statistic.

Worked example

Situation: In a goodness-of-fit test, the statistic \(\chi^2_{\text{obs}}\) is computed from observed and expected frequencies across 6 categories, giving \(\nu = 6 - 1 = 5\) degrees of freedom.

Question 1: What is the cumulative probability \(P(\chi^2 \leq 11.07)\) with \(\nu = 5\)?

Solution: Looking up the CDF of \(\chi^2_5\) at \(x = 11.07\): \[ P(\chi^2 \leq 11.07) \approx 0.95 \] Equivalently, the right tail is \(P(\chi^2 > 11.07) = 0.05\). If the observed statistic were exactly 11.07, the p-value would be 5%.

Question 2: What is the critical value \(\chi^{2*}\) for the test at level \(\alpha = 0.05\) with \(\nu = 5\)?

Solution: We need the 0.95 quantile of \(\chi^2_5\), i.e. the value that leaves 5% in the right tail: \[ \chi^{2*}_{0.05,\,5} = 11.07 \] If \(\chi^2_{\text{obs}} > 11.07\), we reject \(H_0\) at the 5% level.

Interpretation: A large \(\chi^2\) statistic indicates that the observed frequencies deviate from the expected ones under \(H_0\). The threshold 11.07 marks the boundary: only 5% of samples drawn from the hypothesized distribution would produce a statistic larger than that value by chance.

How to interpret the result

The calculator offers three types of output. The PDF, \( f(\chi^2) \), is the density of the distribution at a given point: with few degrees of freedom the curve is strongly right-skewed and decays quickly; as the degrees of freedom grow, the curve flattens and shifts to the right, taking on a more symmetric profile. In the chart, the green area represents the cumulative probability over the selected range; the horizontal axis starts at zero, since the chi-square distribution only takes positive values.

The CDF, \( P(\chi^2 \leq x) \), accumulates probability up to the value \( x \). In hypothesis tests, what usually matters is the right tail: \( P(\chi^2 > x) = 1 - P(\chi^2 \leq x) \), which is the p-value of the test. If that p-value is smaller than the chosen significance level (e.g. 0.05), the null hypothesis is rejected. A large chi-square statistic pushes the probability toward the right tail, indicating discrepancy between the observed and expected distributions.

The quantile output is essential for determining critical values. The 0.95 quantile with \( \nu \) degrees of freedom returns the value \( x^* \) such that \( P(\chi^2 \leq x^*) = 0.95 \): if your test statistic exceeds \( x^* \), you reject at the 5% significance level. It is also used to build confidence intervals for the population variance in normal samples.

Frequently asked questions

  • What is the chi-square distribution used for? It is the reference distribution for goodness-of-fit and independence tests on contingency tables, and for inference about the variance of a normal population.
  • What do the degrees of freedom mean here? A chi-square with k degrees of freedom is the sum of k squared independent standard normals. Its mean is k and its variance 2k, so the degrees of freedom set the location and shape of the curve.
  • Why is the chi-square skewed? Because it only takes non-negative values: mass concentrates near zero and the tail stretches to the right. As the degrees of freedom increase the skew fades and the curve approaches a normal.

Reference: Chi-squared distribution — Wikipedia