Continuous Distributions

the chi-squared distribution

/ KY-squared /

If you take several independent standard-normal numbers, square each one, and add the squares, what do you get? Not a normal distribution any more — squaring forces everything positive and stretches the big values. The result is the chi-squared distribution, the workhorse behind tests of variance and goodness-of-fit.

Write X ~ chi-squared with k degrees of freedom, meaning X = Z_1^2 + Z_2^2 + ... + Z_k^2 where each Z_i is an independent standard normal. It is a special gamma: chi-squared(k) equals Gamma(shape = k/2, scale = 2). Its mean is E[X] = k and its variance is Var(X) = 2k, so its centre and spread are both fixed by the single 'degrees of freedom' k. The shape is right-skewed and lives on the positive axis; as k grows the skew fades and the curve drifts toward a normal shape.

Chi-squared appears wherever you measure squared deviations: the sample variance of normal data scales to a chi-squared, the chi-squared goodness-of-fit and independence tests compare observed to expected counts via summed squared gaps, and it is a component of the t and F distributions. The phrase 'degrees of freedom' is the count of independent squared pieces — a number that drops by one each time you estimate a parameter from the data, which is the subtle bookkeeping at the heart of using it correctly.

Take 3 independent standard normals, say 1.2, -0.5, and 0.8. Their squares sum to 1.44 + 0.25 + 0.64 = 2.33, one draw from a chi-squared with k = 3 degrees of freedom (whose mean is 3).

Sum k squared standard normals to get a chi-squared with k degrees of freedom.

Degrees of freedom is not just the sample size — estimating a mean or other parameter from the same data 'uses up' degrees of freedom, so using n instead of the right reduced count biases your test.

Also called
chi-squarechi-squared卡方分配chi^2 distribution