Chi-Square Distribution Calculator

Calculate p-value from chi-square statistic.

Please enter a valid chi-square value (must be >= 0)

Examples:

Enter χ² value and degrees of freedom

What Is the Chi-Square Distribution?

The chi-square (χ²) distribution arises when you sum squared standard normal variables. It's fundamental to tests of independence, goodness of fit, and variance comparisons.

Key parameter: Degrees of freedom (df)

Properties:

  • Always non-negative (sum of squares)
  • Right-skewed (more so for small df)
  • Mean = df
  • Variance = 2 × df

From χ² Statistic to P-Value

This calculator converts a chi-square statistic to a p-value:

Example: χ² = 12.5, df = 5 P-value = P(χ² > 12.5) = 0.029

Since this is less than 0.05, the result is statistically significant.

Applications

Chi-Square Test of Independence

"Is there an association between two categorical variables?"

Outcome AOutcome B
Group 13070
Group 25050

χ² measures the discrepancy between observed and expected counts. df = (rows - 1) × (columns - 1) = 1

Chi-Square Goodness of Fit

"Does observed data match expected proportions?"

Example: Testing if a die is fair. df = categories - 1 = 5

Variance Testing

"Is the population variance equal to a hypothesized value?"

χ2=(n−1)s2σ02,df=n−1\chi^2 = \frac{(n-1)s^2}{\sigma_0^2}, \quad df = n - 1

Confidence Interval for Variance

The chi-square distribution provides critical values for variance confidence intervals.

Distribution Shape

The chi-square distribution changes with df:

dfShape
1-2Highly right-skewed, mode at 0
3-5Right-skewed
10+More symmetric, approaching normal
30+Nearly normal, mean = df

As df increases, the distribution becomes more symmetric and approaches normal.

Critical Values

For α = 0.05 (right-tail probability):

dfχ² critical
13.84
25.99
511.07
1018.31
2031.41
3043.77

The Inverse Chi-Square Calculator finds critical values for any df and probability.

Historical Development

The chi-square distribution emerged from work by several statisticians:

Friedrich Helmert (1876) first derived the distribution of the sum of squared normal variables in the context of measurement errors.

Karl Pearson (1900) developed the chi-square test for goodness of fit, one of the first formal statistical tests. His test for contingency tables revolutionized the analysis of categorical data.

Ronald Fisher extended the theory, clarifying degrees of freedom and developing related tests.

The name "chi-square" comes from the Greek letter χ (chi), used by Pearson in his notation.

Mathematical Definition

If Z1,Z2,…,ZkZ_1, Z_2, \ldots, Z_k are independent standard normal variables:

χ2(k)=Z12+Z22+…+Zk2\chi^2(k) = Z_1^2 + Z_2^2 + \ldots + Z_k^2

The sum of k squared standard normals follows χ2(k)\chi^2(k).

This explains why χ² is always non-negative and right-skewed.

Relationship to Other Distributions

Normal: Sum of squared standard normals → χ²

T-distribution: T² ~ F(1, df), and T = Z/√(χ²/df)

F-distribution: F = (χ₁²/df₁) / (χ₂²/df₂)

Gamma: χ²(k) = Gamma(k/2, 2)

Exponential: χ²(2) is exponential with mean 2

Chi-Square and Sample Variance

For a sample from a normal distribution:

(n−1)s2σ2∼χ2(n−1)\frac{(n-1)s^2}{\sigma^2} \sim \chi^2(n-1)

This relationship underlies:

  • Confidence intervals for variance
  • Tests comparing variance to a hypothesized value
  • F-tests comparing two variances

Degrees of Freedom in Practice

Goodness of fit: df = categories - 1 - estimated parameters

Independence test: df = (rows - 1) × (columns - 1)

Variance test: df = n - 1

The Degrees of Freedom Calculator helps determine df for various tests.

Assumptions for Chi-Square Tests

For contingency tables:

  • Expected cell counts ≥ 5 (traditional rule)
  • Independent observations
  • Random sampling

When expected counts are small:

  • Use Fisher's exact test (2×2 tables)
  • Combine categories if possible
  • Use exact multinomial tests

For variance tests:

  • Data from normal distribution
  • Random sampling

Chi-square tests for variance are sensitive to non-normality.

Computing P-Values

The chi-square CDF has no closed form—it's computed via:

  • Incomplete gamma function
  • Numerical integration
  • Series approximations

For large df, normal approximation works: χ² ≈ Normal(df, √(2×df))

One-Tailed vs. Two-Tailed

Chi-square tests are typically one-tailed (right-tail):

  • Test statistic measures deviation from expected
  • Only large χ² values indicate significant departure

For variance tests, two-tailed tests use both tails:

  • Lower tail: variance too small?
  • Upper tail: variance too large?

Related Calculations

Summary

The chi-square distribution—the sum of squared standard normal variables—is fundamental to categorical data analysis and variance inference. Tests of independence, goodness of fit, and variance hypotheses all rely on chi-square p-values. The distribution is parameterized by degrees of freedom, which determine its shape from highly skewed (small df) to nearly normal (large df). Understanding the chi-square distribution enables proper interpretation of contingency table analyses and variance tests across many fields.