The Chi-Squared Distribution

Version 6 | Created: 2026-09-04 | Updated: 2026-11-07 13:46 UTC
- 1. Scope
- 2. Definition
- 3. Properties
- 4. Relation to Other Distributions
- 5. Role in Sampling
- 6. Tests Built on the Distribution
- References
- Appendix A. Terminology
- Appendix B. Derivations
- Appendix C. Computation
νμ€μ κ· νλ₯ λ³μμ μ κ³±ν©μ΄ λ°λ₯΄λ λΆν¬μ λν κΈ°λ‘. μ΄λ»κ² λ§λ€μ΄μ§λμ§, λ°λν¨μμ moment κ° λ¬΄μμΈμ§, λ€λ₯Έ νλ³ΈλΆν¬μ μ΄λ»κ² μ΄μ΄μ§λμ§, κ·Έλ¦¬κ³ μ΄λ₯Ό μ°λ κ²μ μ μ λ±μ₯νλμ§λ₯Ό λ€λ£¬λ€.
Chi-squared distribution μ μλ£μ model λ‘ λ§λλ μΌμ΄ λλ¬Όλ€. ν΅κ³λμ λΆν¬λ‘ λ§λλ©°, μ±μ§μ΄ μμ£Ό λ€λ₯Έ λ μμ΄ κ³΅κ΅λ‘κ²λ μ΄ λΆν¬λ₯Ό λ°λ₯΄κΈ°μ μ리λ₯Ό μ»λλ€. νλλ μ κ·λͺ¨μ§λ¨μ μ²λμ‘°μ λ sample variance μ΄κ³ , λ€λ₯Έ νλλ κ΄μΈ‘λμμ κΈ°λλμμ μ°¨μ΄λ₯Ό μ¬λ Pearson μ μΈ‘λμ΄λ€. λ λ€ κ·Όμ¬μ μΌλ‘ νμ€μ κ·μΈ μλ€μ μ κ³±ν©μΌλ‘ νμλλ©°, κ·Έ μ κ³±ν©μ΄ λ°λ‘ μ΄ λΆν¬κ° κΈ°μ νλ λμμ΄λ€.
μ΄ λ¬Έμλ λΆν¬λ₯Ό μ μνκ³ , λ°λν¨μμ moment λ₯Ό μ μνκ³ , normalΒ·gammaΒ·tΒ·F distribution κ³Όμ κ΄κ³λ₯Ό μ 리νκ³ , μμ λ μν©μ 보μΈλ€. μ λλ Appendix B μ, λΆν¬λ₯Ό κ³μ°νλ νΈμΆμ Appendix C μ λλ€.
μ΄ κ΅¬μ±μ΄ νκΊΌλ²μ μΈ κ°μ§λ₯Ό μ νλ€. μ κ³±ν©μ μμκ° λ μ μμΌλ―λ‘ support λ
μ΄ μμ μ΄λμλ
Moment generating function μ λ°λν¨μλ³΄λ€ λ¨μνλ©°, λ€μ μ€λ λλΆλΆμ λ Όμκ° μ΄κ²μ λκ΅¬λ‘ μ΄λ€.
μ (3) μ μμ μμ λ―ΈλΆνλ©΄ moment κ° λμ¨λ€. νκ· μ μμ λμ κ°κ³ λΆμ°μ κ·Έ λ λ°°μ΄λ€.
μ¬κΈ°μ
Table 1. Moments of the chi-squared distribution.
| Degrees of freedom | Mean | Variance | Skewness | Excess kurtosis |
|---|---|---|---|---|
| 1 | 1 | 2 | 2.8284 | 12.0 |
| 2 | 2 | 4 | 2.0000 | 6.0 |
| 3 | 3 | 6 | 1.6330 | 4.0 |
| 5 | 5 | 10 | 1.2649 | 2.4 |
| 10 | 10 | 20 | 0.8944 | 1.2 |
νκ· μ΄
λ
λ¦½μΈ λ μ κ³±ν©μ ν©μ λ€μ μ κ³±ν©μ΄λ―λ‘ μ (1) μμ κ³§λ°λ‘ λ°λ₯΄κ³ , λ moment generating function μ
κ³±μ΄ μ§μ
λͺ¨μμ
Fig 1. Chi-squared density (a) and distribution function (b) for five values of the degrees of
freedom. The density for
μλ ΄μ λ리λ€. μ (4) μ μλκ°
Table 2. Upper-tail critical values: the value the statistic exceeds with the stated probability.
| Degrees of freedom | 0.10 | 0.05 | 0.01 |
|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 |
| 2 | 4.605 | 5.991 | 9.210 |
| 3 | 6.251 | 7.815 | 11.345 |
| 4 | 7.779 | 9.488 | 13.277 |
| 5 | 9.236 | 11.070 | 15.086 |
| 6 | 10.645 | 12.592 | 16.812 |
| 7 | 12.017 | 14.067 | 18.475 |
| 8 | 13.362 | 15.507 | 20.090 |
| 9 | 14.684 | 16.919 | 21.666 |
| 10 | 15.987 | 18.307 | 23.209 |
| 15 | 22.307 | 24.996 | 30.578 |
| 20 | 28.412 | 31.410 | 37.566 |
| 30 | 40.256 | 43.773 | 50.892 |
Chi-squared distribution μ μ κ·μ΄λ‘ νλ³ΈλΆν¬λ€μ νκ°μ΄λ°μ μκ³ , λλ¨Έμ§ λλΆλΆμ μ΄κ²μΌλ‘λΆν° λ§λ€μ΄μ§λ€.
Table 3. Relations to other distributions.
| Distribution | Relation | Note |
|---|---|---|
| Normal |
|
|
| Exponential |
|
|
| Gamma |
|
λ°λν¨μμ μΌλ°ν |
| Student t |
|
Chi-squared κ° λΆλͺ¨ |
| F |
|
λ chi-squared μ λΉ |
| Noncentral chi-squared | νκ· μ΄ 0 μ΄ μλ μ κ· λ³μλ€μ μ κ³±ν© | μλ κ²μ λ€μ κ²μ λ ₯μ μ°μ |
첫 νμ Table 2 λ‘ νμΈν μ μλ€. νμ€μ κ·μ μμΈ‘ 5 percent μ μ 1.96 μ΄κ³
μλ μμ λ νλλ
μ (7) μ λ€μ§μΌλ©΄ μ κ· λΆμ°μ confidence interval μ΄ λμ€λ©°, λΆν¬κ° λΉλμΉμ΄λ―λ‘ κ΅¬κ°λ λΉλμΉμ΄λ€.
μ΄ λΆν¬λ₯Ό μ°λ λͺ¨λ μ리μμ μμ λλ μ μ½μ΄ κ±Έλ¦° λ€μλ μμ λ‘κ² λ³ν μ μλ μμ κ°μλ₯Ό μΈλ©°, κ°μ μλ£μμ μΆμ ν parameter νλλ§λ€ νλμ© μ€μ΄λ λ€. μ (7) μμ μ μ½μ μΆμ ν νκ· νλμ΄κ³ , section 6 μ κ²μ μμλ κΈ°λλμκ° λ§μΆ°μΌ νλ ν©κ³μμ μ μ½μ΄ λμ¨λ€. μ΄ κ°μλ₯Ό ν리면 ν΅κ³λμ΄ ν리λ κ²μ΄ μλλΌ κΈ°μ€λΆν¬κ° ν리λλ°, κ·Έμͺ½μ΄ μμμ±κΈ° λ μ΄λ ΅λ€.
κ°μ€ μλμμ κ° νμ λλ΅ νμ€νλ νΈμ°¨μ μ κ³±μ΄λ―λ‘ ν©μ λλ΅ νμ€μ κ·μ μ κ³±ν©μ΄ λκ³ μ (1) μ΄
μ μ©λλ€. μλ£μμ μΆμ ν parameter κ° μμΌλ©΄ μμ λλ
μ£Όμ¬μλ₯Ό 300 λ² κ΅΄λ € 43, 52, 54, 61, 48, 42 κ° λμλ€λ©΄ κΈ°λλμλ λͺ¨λ 50 μ΄κ³ ν΅κ³λμ μμ λ 5 μμ 5.160 μ΄λ€. Table 2 κ° 5 percent μ μΌλ‘ 11.070 μ μ£Όλ―λ‘ μ΄ λμλ νΉλ³ν κ²μ΄ μμΌλ©°, μ νν μμ꼬리 νλ₯ μ 0.397 μ΄λ€.
μ΄ κ²μ μ λ°μΉλ κ²μ κ° cell λμμ λν μ κ· κ·Όμ¬μ΄κ³ , κΈ°λλμκ° μμΌλ©΄ κ·Έ κ·Όμ¬κ° κΉ¨μ§λ€. ν΅μμ μ€λ¬΄ κΈ°μ€μ λͺ¨λ κΈ°λλμκ° 5 μ΄μμ΄μ΄μΌ νλ€λ κ²μ΄λ€.
νμ΄
μμ λλ section 5.2 λ₯Ό λ°λ₯Έλ€. νμλ
νμ΄ 38, 62 μ 51, 49 μΈ 2Γ2 νμμλ κΈ°λλμκ° λͺ¨λ 44.5 μλλ©΄ 55.5 μ΄κ³ , ν΅κ³λμ μμ λ 1 μμ 3.421, μμ꼬리 νλ₯ μ 0.064 μ΄λ€. Table 2 μ 3.841 μ 견주면 λ νμ μ°¨μ΄λ 5 percent μμ€μμ μ μνμ§ μλ€.
[1] Wilson, E. B., & Hilferty, M. M. (1931). The Distribution of Chi-Square. Proceedings of the
National Academy of Sciences, 17(12), 684β688.
[2] Cochran, W. G. (1934). The Distribution of Quadratic Forms in a Normal System, with
Applications to the Analysis of Covariance. Mathematical Proceedings of the Cambridge
Philosophical Society, 30(2), 178β191.
[3] Pearson, K. (1900). On the Criterion that a Given System of Deviations from the Probable in the
Case of a Correlated System of Variables is Such that it Can be Reasonably Supposed to have Arisen
from Random Sampling. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of
Science, 50(302), 157β175.
[4] Johnson, N. L., Kotz, S., & Balakrishnan, N. (1994). Continuous Univariate Distributions
(Vol. 1, 2nd ed.). Wiley. ISBN 978-0-471-58495-7.
- Cell: λμλ₯Ό λ΄λ, λ²μ£Ό λΆλ₯μ ν κ°λ.
- Contingency table: λ λ²μ£Όν λ³μλ‘ κ΅μ°¨λΆλ₯ν λμν.
- Degrees of freedom: μ μ½μ΄ κ±Έλ¦° λ€μλ μμ λ‘κ² λ³ν μ μλ μμ κ°μμ΄λ©°, chi-squared distribution μ parameter.
- Excess kurtosis: λ€ λ²μ§Έ νμ€ν moment μμ 3 μ λΊ κ°μ΄λ©°, μ κ·λΆν¬μμ 0.
- Margin: λμνμ ν ν©κ³ λλ μ΄ ν©κ³.
-
Moment generating function:
$t$ μ ν¨μλ‘ λ³Έ$E[e^{tX}]$ μ΄λ©°, μμ μμμ λν¨μκ° moment. - Skewness: μΈ λ²μ§Έ νμ€ν moment μ΄λ©°, λμΉλΆν¬μμ 0.
- Support: λΆν¬κ° μμ νλ₯ μ μ£Όλ κ°μ μ§ν©.
- Survival function: 1 μμ λΆν¬ν¨μλ₯Ό λΊ κ², κ³§ μμ꼬리 νλ₯ .
μ (1) μ ꡬμ±μ νμ€μ κ· λ³μμμ μΆλ°νμ§λ§, μΈ‘μ κ°μ΄ νμ€νλ μ±λ‘ μ€λ μΌμ λλ¬Όλ€. μλ μ 리λ μΌλ°μ μΈ κ²½μ°λ₯Ό λ€λ£¬λ€.
μ 리.
μ¦λͺ
.
λ¨μ μΌμ μ (13) μ μμ보λ κ²μ΄λ€. μ (2) μ
μ (5) μ ν¨κ» μ½μΌλ©΄, μ΄ μ 리λ νμ€μ κ· λ³μκ° μλλΌ μΈ‘μ κ°μμ μ΄ λΆν¬μ‘±μ λΏκ² ν΄ μ£Όλ κ²μ΄λ€.
λ
λ¦½μΈ μ κ· κ΄μΈ‘κ°
μ κ³± νλμ λν΄, μ μνλ μ λΆμμ
λ¨μ μ λΆμ νμ€μ κ· λ°λν¨μμ μ 체 μ§λμ΄λ―λ‘ 1 μ΄λ€. μ (1) μ
μ (3) μ μμ μμ μ κ°νκ±°λ λ λ² λ―ΈλΆνλ€.
μ°Ένκ· μμμ νΈμ°¨μ κ³±ν©μ μ°κ³ κ° μ κ³± μμμ
λΆν¬μ κ·Έ μν¨μλ scipy.stats.chi2 μμ μ»λλ€. Survival function sf λ μμ꼬리λ₯Ό κ³§λ°λ‘ μ£Όλ©°
꼬리 κΉμ κ³³μμ μ λ°λλ₯Ό μλ 1 - cdf λ³΄λ€ λ«λ€. isf λ κ·Έκ²μ λ€μ§μ΄ Table 2 μ κ°μ λ§λ λ€.
# Python
from scipy import stats
print(stats.chi2.isf(0.05, df=5)) # upper 5 percent point
print(stats.chi2.sf(5.16, df=5)) # upper tail probability of an observed statistic
print(stats.chi2.stats(df=5, moments='mv'))11.070497693516355
0.3966674666097388
(np.float64(5.0), np.float64(10.0))
Section 6 μ λ κ²μ μ κ°κ° νΈμΆ ν λ²μ΄κ³ , λ λ€ ν΅κ³λκ³Ό κ·Έ μμ꼬리 νλ₯ μ ν¨κ» λλ €μ€λ€.
# Python
import numpy as np
from scipy import stats
print(stats.chisquare(f_obs=np.array([43, 52, 54, 61, 48, 42])))
statistic, p_value, degrees, expected = stats.chi2_contingency(np.array([[38, 62], [51, 49]]),
correction=False)
print(round(statistic, 4), degrees, round(p_value, 4))Power_divergenceResult(statistic=np.float64(5.16), pvalue=np.float64(0.3966674666097388))
3.4214 1 0.0644
κΈ°λ³Έκ° λ κ°μ§λ μμ λ λ§νλ€. stats.chisquare λ f_exp λ₯Ό μ£Όμ§ μμΌλ©΄ κΈ°λλμκ° λͺ¨λ κ°λ€κ³
보며, ddof λ‘ μΆμ ν parameter κ°μλ₯Ό μλ €μ£Όμ§ μμΌλ©΄ μμ λλ₯Ό stats.chi2_contingency λ 2Γ2 νμμ Yates μ μ°μμ± λ³΄μ μ κΈ°λ³ΈμΌλ‘ μ μ©νλ―λ‘, section 6.2 μ
보μ νμ§ μμ ν΅κ³λμ μ¬ννλ €λ©΄ correction=False κ° νμνλ€.
Version 9 | Created: 2026-09-03 | Updated: 2026-11-07 13:46 UTC
- 1. Scope
- 2. Definition
- 3. Properties
- 4. Relation to Other Distributions
- 5. Role in Sampling
- 6. Tests Built on the Distribution
- References
- Appendix A. Terminology
- Appendix B. Derivations
- Appendix C. Computation
A note on the distribution of a sum of squared standard normal variables: how it is built, what its density and moments are, how it relates to the other sampling distributions, and why it turns up in the tests that use it.
The chi-squared distribution is not usually met as a model of data. It is met as the distribution of a statistic, and it earns its place because two very different quantities happen to follow it. One is the scaled sample variance of a normal population. The other is Pearson's measure of the gap between observed and expected counts. Both reduce to a sum of squares of quantities that are approximately standard normal, and that sum is what the distribution describes.
This document defines the distribution, gives its density and moments, sets out its relations to the normal, gamma, t and F distributions, and shows the two settings above. The derivations are in Appendix B and the calls that evaluate the distribution are in Appendix C.
Let
The construction fixes three things at once. The support is
The density of
Nothing in this expression requires
The moment generating function is simpler than the density and is the tool used for most of what follows.
Differentiating equation (3) at the origin gives the moments. The mean is the degrees of freedom and the variance is twice it.
Here
Table 1. Moments of the chi-squared distribution.
| Degrees of freedom | Mean | Variance | Skewness | Excess kurtosis |
|---|---|---|---|---|
| 1 | 1 | 2 | 2.8284 | 12.0 |
| 2 | 2 | 4 | 2.0000 | 6.0 |
| 3 | 3 | 6 | 1.6330 | 4.0 |
| 5 | 5 | 10 | 1.2649 | 2.4 |
| 10 | 10 | 20 | 0.8944 | 1.2 |
That the mean equals
If
This follows immediately from equation (1), since the sum of two independent sums of squares is
again a sum of squares, and just as directly from equation (3), since the product of the two moment
generating functions is the one with exponent
The shape changes qualitatively with
Fig 1. Chi-squared density (a) and distribution function (b) for five values of the degrees of
freedom. The density for
As
The convergence is slow, because the skewness in equation (4) falls only as
Table 2. Upper-tail critical values: the value the statistic exceeds with the stated probability.
| Degrees of freedom | 0.10 | 0.05 | 0.01 |
|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 |
| 2 | 4.605 | 5.991 | 9.210 |
| 3 | 6.251 | 7.815 | 11.345 |
| 4 | 7.779 | 9.488 | 13.277 |
| 5 | 9.236 | 11.070 | 15.086 |
| 6 | 10.645 | 12.592 | 16.812 |
| 7 | 12.017 | 14.067 | 18.475 |
| 8 | 13.362 | 15.507 | 20.090 |
| 9 | 14.684 | 16.919 | 21.666 |
| 10 | 15.987 | 18.307 | 23.209 |
| 15 | 22.307 | 24.996 | 30.578 |
| 20 | 28.412 | 31.410 | 37.566 |
| 30 | 40.256 | 43.773 | 50.892 |
The chi-squared distribution sits at the centre of the normal-theory sampling distributions, and most of the others are built from it.
Table 3. Relations to other distributions.
| Distribution | Relation | Note |
|---|---|---|
| Normal | The case |
|
| Exponential |
|
The case |
| Gamma |
|
The general form of the density |
| Student t |
|
The chi-squared is the denominator |
| F |
|
A ratio of two chi-squared variables |
| Noncentral chi-squared | Sum of squares of normals with nonzero means | Used for the power of the tests below |
The first row can be checked against Table 2. The two-sided 5 percent point of the standard normal
is 1.96, and
For
The degree of freedom that is lost is the one spent estimating
Inverting equation (7) gives the confidence interval for a normal variance, which is asymmetric because the distribution is.
Across every use of the distribution, the degrees of freedom count the quantities that are free to vary once the constraints are imposed, and each parameter estimated from the same data removes one more. In equation (7) the single constraint is the estimated mean; in the tests of section 6 the constraints come from the totals the fitted counts must reproduce. Getting this count wrong does not make the statistic wrong; it makes the reference distribution wrong, which is harder to notice.
Given counts
Under the hypothesis, each term is roughly a squared standardised deviation, so the sum is roughly
a sum of squared standard normals and equation (1) applies. With no parameter estimated from the
data the degrees of freedom are
For 300 rolls of a die giving 43, 52, 54, 61, 48 and 42, every expected count is 50 and the statistic is 5.160 on 5 degrees of freedom. Table 2 gives 11.070 as the 5 percent point, so the counts are unremarkable; the exact upper-tail probability is 0.397.
The approximation behind the test is the normal approximation to each cell count, and it fails when the expected counts are small. The usual working rule is that every expected count should be at least 5.
For a table of counts with
The degrees of freedom follow section 5.2. The table has
A two-by-two table with rows 38, 62 and 51, 49 has every expected count equal to 44.5 or 55.5, a statistic of 3.421 on 1 degree of freedom, and an upper-tail probability of 0.064. Against the 3.841 of Table 2 the difference between the two rows is not significant at the 5 percent level.
[1] Wilson, E. B., & Hilferty, M. M. (1931). The Distribution of Chi-Square. Proceedings of the
National Academy of Sciences, 17(12), 684β688.
[2] Cochran, W. G. (1934). The Distribution of Quadratic Forms in a Normal System, with
Applications to the Analysis of Covariance. Mathematical Proceedings of the Cambridge
Philosophical Society, 30(2), 178β191.
[3] Pearson, K. (1900). On the Criterion that a Given System of Deviations from the Probable in the
Case of a Correlated System of Variables is Such that it Can be Reasonably Supposed to have Arisen
from Random Sampling. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of
Science, 50(302), 157β175.
[4] Johnson, N. L., Kotz, S., & Balakrishnan, N. (1994). Continuous Univariate Distributions
(Vol. 1, 2nd ed.). Wiley. ISBN 978-0-471-58495-7.
- Cell: one class of a categorical classification, holding a count.
- Contingency table: a table of counts cross-classified by two categorical variables.
- Degrees of freedom: the number of quantities free to vary once the constraints on them are imposed; the parameter of the chi-squared distribution.
- Excess kurtosis: the fourth standardised moment less 3, so that the normal distribution has the value 0.
- Margin: a row total or a column total of a table of counts.
-
Moment generating function:
$E[e^{tX}]$ as a function of$t$ , whose derivatives at the origin are the moments. - Skewness: the third standardised moment, zero for a symmetric distribution.
- Support: the set of values a distribution gives positive probability to.
- Survival function: one minus the distribution function, that is the upper-tail probability.
The construction in equation (1) starts from standard normal variables, but a measurement rarely arrives standardised. The theorem below states the general case.
Theorem. Let
Proof. Put
Being a square,
Differentiate with respect to
What remains is to recognise equation (13). Setting
Read together with equation (5), the theorem is what makes the family reachable from measurements
rather than from standard normal variables: standardising and squaring
For a single square, substitute
The remaining integral is the total mass of the standard normal density and equals 1. Since the
Expand equation (3) about the origin, or differentiate it twice. The first two derivatives at
Setting
Write the sum of squared deviations from the true mean and add and subtract
The cross term vanishes because the deviations from
The distribution and its inverse come from scipy.stats.chi2. The survival function sf gives the
upper tail directly and is preferred over 1 - cdf, which loses precision far out in the tail,
while isf inverts it and produces the entries of Table 2.
# Python
from scipy import stats
print(stats.chi2.isf(0.05, df=5)) # upper 5 percent point
print(stats.chi2.sf(5.16, df=5)) # upper tail probability of an observed statistic
print(stats.chi2.stats(df=5, moments='mv'))11.070497693516355
0.3966674666097388
(np.float64(5.0), np.float64(10.0))
The two tests of section 6 are each one call, and both return the statistic with its upper-tail probability.
# Python
import numpy as np
from scipy import stats
print(stats.chisquare(f_obs=np.array([43, 52, 54, 61, 48, 42])))
statistic, p_value, degrees, expected = stats.chi2_contingency(np.array([[38, 62], [51, 49]]),
correction=False)
print(round(statistic, 4), degrees, round(p_value, 4))Power_divergenceResult(statistic=np.float64(5.16), pvalue=np.float64(0.3966674666097388))
3.4214 1 0.0644
Two defaults are worth knowing. stats.chisquare assumes equal expected counts unless f_exp is
given, and it takes the degrees of freedom as ddof says how many parameters were
estimated. stats.chi2_contingency applies Yates's continuity correction by default on a
two-by-two table, so reproducing the uncorrected statistic of section 6.2 needs
correction=False.

