Chi-square test for one variance
Variances (spread) · One sample · reference distribution: χ²(n−1)
When to use it
Test whether the variance of a process is at the specified value, as in quality control.
Null hypothesis
The population variance is σ₀².
Assumptions
- Normal data: the test is very sensitive to departures from normality
Test statistic
\chi^2 = \dfrac{(n - 1)\, s^2}{\sigma_0^2}How to report it
χ²(24) = 38.9, p = .056
In R and Python
R
library(EnvStats)
varTest(x, sigma.squared = 4)
Python
q = (len(x) - 1) * x.var(ddof=1) / 4
p = 2 * min(stats.chi2.cdf(q, len(x) - 1), stats.chi2.sf(q, len(x) - 1))
In Python, stats is scipy.stats and np is numpy.
Where it sits in the catalog
Variances (spread). They compare how spread out the data are, not the center. Useful on their own, as in quality control, and to check the equal-variance assumption of other tests.
One sample. A single group compared with a reference value set in advance, such as a target or a standard.
In the decision tree
- What do you want to do? Compare groups, or one group with a reference value
- What kind of response did you measure? The spread, not the center
- How many groups or measurements? One group, against a reference variance