One-Sample Variance Test Calculator
Inputs
- Inputs: sample variance 18.50, hypothesised variance 12.25, sample size 30.
- Chi-square = (30 - 1) x 18.50 / 12.25 = 43.80 on 29 degrees of freedom.
- The two-sided p-value doubles the smaller tail: p = 0.0767.
- The sample variance is compatible with the hypothesised value at the 5% level.
Means get the famous tests; variances get this one. For a sample from a normal distribution, (n - 1) s^2 / sigma0^2 follows a chi-square distribution, which turns 'has the spread changed?' into a single statistic. This calculator takes the sample variance, the hypothesised variance and the sample size, and returns the chi-square statistic, its degrees of freedom, the variance ratio and a two-sided p-value - the test used in quality control, assay validation and anywhere consistency itself is the specification.
Worked examples
Variance somewhat high
(18.5 · 12.25 · 30)
| Chi-square statistic | 43.80 |
| p-value (two-sided) | 0.0767 |
| Degrees of freedom | 29 |
| Variance ratio | 1.510 |
Variance on target
(9.8 · 10 · 51)
| Chi-square statistic | 49.00 |
| p-value (two-sided) | 0.9730 |
| Degrees of freedom | 50 |
| Variance ratio | 0.980 |
Variance clearly high
(30 · 16 · 20)
| Chi-square statistic | 35.63 |
| p-value (two-sided) | 0.0235 |
| Degrees of freedom | 19 |
| Variance ratio | 1.875 |
Why variance needs its own test
A process can hold its mean perfectly while its variance doubles - parts still average to specification while twice as many fall outside the tolerance. Tests on the mean are blind to that failure, which is why manufacturing, metrology and analytical chemistry maintain variance tests as first-class tools. The one-sample chi-square test is the basic instrument: it asks whether an observed sample variance is compatible with a claimed population variance, in either direction.
The construction is exact under normality. The sample variance of normal data, scaled by (n - 1)/sigma^2, is a sum of n - 1 squared standard normals - a chi-square variable. That is the whole derivation, and also the source of the test's famous fragility: the chi-square law for s^2 depends on the parent distribution's shape far more sensitively than the t distribution for the mean does.
- Statistic: chi-square = (n - 1) s^2 / sigma0^2
- Degrees of freedom: n - 1
- Two-sided p-value: twice the smaller tail, capped at 1
- Exact for normal data; fragile under heavy tails
Building the chi-square statistic
In the first worked example a sample variance of 18.5 against a hypothesised 12.25 - a variance ratio of 1.510 - over 30 observations gives chi-square = 29 x 18.5/12.25 = 43.80 on 29 degrees of freedom. The two-sided p-value is 0.0767: the upper tail alone is about half that, and doubling it prices deviations in both directions. A variance half again too large, in a sample of 30, is suggestive and no more - the sampling distribution of a variance is wide and skewed, and the test reports that honestly.
The second example is the null behaving: variance 9.8 against 10 over 51 observations gives 49.00 on 50 degrees of freedom and p = 0.9730, about as compatible as data can be. The third example, variance 30 against 16 in only 20 observations, reaches 35.63 on 19 degrees of freedom with p = 0.0235 - a smaller sample than the first, but a ratio of 1.875 large enough to convict.
| Example | s^2 | sigma0^2 | n | Chi-square | p (two-sided) |
|---|---|---|---|---|---|
| 1 | 18.5 | 12.25 | 30 | 43.80 | 0.0767 |
| 2 | 9.8 | 10 | 51 | 49.00 | 0.9730 |
| 3 | 30 | 16 | 20 | 35.63 | 0.0235 |
Worked examples
Example 1: Sample variance s^2 18.5; Hypothesised variance sigma0^2 12.25; Sample size (n) 30. Chi-square statistic = 43.80. Supporting values: p-value (two-sided) 0.0767; Degrees of freedom 29; Variance ratio 1.510. Inputs: sample variance 18.50, hypothesised variance 12.25, sample size 30. Chi-square = (30 - 1) x 18.50 / 12.25 = 43.80 on 29 degrees of freedom. The two-sided p-value doubles the smaller tail: p = 0.0767. The sample variance is compatible with the hypothesised value at the 5% level.
Example 2: Sample variance s^2 9.8; Hypothesised variance sigma0^2 10; Sample size (n) 51. Chi-square statistic = 49.00. Supporting values: p-value (two-sided) 0.9730; Degrees of freedom 50; Variance ratio 0.980. Inputs: sample variance 9.80, hypothesised variance 10.00, sample size 51. Chi-square = (51 - 1) x 9.80 / 10.00 = 49.00 on 50 degrees of freedom. The two-sided p-value doubles the smaller tail: p = 0.9730. The sample variance is compatible with the hypothesised value at the 5% level.
Example 3: Sample variance s^2 30; Hypothesised variance sigma0^2 16; Sample size (n) 20. Chi-square statistic = 35.63. Supporting values: p-value (two-sided) 0.0235; Degrees of freedom 19; Variance ratio 1.875. Inputs: sample variance 30.00, hypothesised variance 16.00, sample size 20. Chi-square = (20 - 1) x 30.00 / 16.00 = 35.63 on 19 degrees of freedom. The two-sided p-value doubles the smaller tail: p = 0.0235. The sample variance differs significantly from the hypothesised value.
Two-sided p-values for a skewed distribution
The chi-square distribution is lopsided, so 'two-sided' needs a definition. The convention used here - double the smaller tail probability - treats a variance suspiciously far below the hypothesised value symmetrically with one above, in probability rather than in distance. It is the common textbook convention and the one most software reports for this test. Alternatives based on equal density points exist and can differ noticeably at small degrees of freedom; when a result is borderline, state which convention produced it.
One-sided versions are legitimate when the question is one-sided - a regulator asking only whether variability has increased, for instance. Halving is not the way to get them from this page's output in general, because the doubled-tail construction has already spent both tails; compute the relevant tail directly from the statistic and degrees of freedom instead.
The normality caveat
Everything above leans on normal data, and the lean is heavy. For heavy-tailed distributions the true variance of s^2 is much larger than the chi-square law assumes, so the test rejects true nulls far too often - it reads kurtosis as variance change. This is the sharpest robustness failure among the elementary tests, sharper than anything the t-test suffers, and it is the reason Levene's test and the Brown-Forsythe variant exist: they test spread through absolute deviations, trading the chi-square's exactness for distributions that survive contact with real data.
The practical rule: if the data are plausibly normal - residuals from a fitted model on a well-behaved process, repeated physical measurements - the chi-square test is the most powerful choice and its exactness is real. If the data are skewed counts, incomes, or anything with visible outliers, treat a rejection as a prompt to run a robust alternative, not as a finding.
Practical notes
Enter variances, not standard deviations: the inputs are s^2 and sigma0^2, and squaring a standard deviation before entry is the user's job - the worked examples' 12.25, for instance, is the square of a hypothesised standard deviation. Sample size enters twice, in the statistic and in the degrees of freedom, so an off-by-one in n moves both; the calculator uses n - 1 degrees of freedom, the standard unbiased-variance convention.
Used in its proper habitat - process monitoring, instrument qualification, checking that a simulation's noise matches its specification - the test is quick, exact and decisive at the extremes, as the third example shows. Used on heavy-tailed field data, it is a kurtosis detector wearing a variance test's uniform, and its p-values should be priced accordingly.
The two-sample descendant of this test - the F test for equality of two variances - inherits both its exactness and its fragility, and the family resemblance is instructive. Generations of textbooks taught the F test as the gatekeeper for pooled t-tests, until its sensitivity to non-normality became undeniable and practice shifted to Welch's unequal-variance t-test, which needs no gatekeeper. The one-sample chi-square test survives where its assumptions are manufactured rather than hoped for: calibrated instruments, controlled processes, simulated noise - settings where normality is engineered into the data before the test is applied.
There is a Bayesian mirror worth knowing. With the standard reference prior, the posterior for the variance is a scaled inverse chi-square, and the credible interval it produces is numerically close to the classical one - the two frameworks agree here because the likelihood is doing all the work. Where they part is interpretation: the classical p-value of 0.0767 in the first example is a statement about data under a hypothesis, not a probability that the variance is 12.25, and the discipline of saying so is the price of using the sharper tool.
The test also has a quiet role inside other procedures: it is the building block of Bartlett's test for equal variances across groups and the reference distribution behind confidence intervals for a single variance, which are read off the same chi-square quantiles by inversion. A confidence interval is often the better report than the test in any case - the first example's data, expressed as an interval for the true variance, would show 12.25 sitting inside it near the edge, which conveys the p = 0.0767 verdict and the precision of the estimate in a single picture. Tests answer questions; intervals show workings, and for a quantity as slippery as a variance the workings are usually the point.
A last word on reporting. Because the statistic is a ratio at heart - observed spread against claimed spread, scaled by the information in the sample - the most informative single line in a report is the variance ratio with its sample size: 1.510 on 30 observations, 1.875 on 20. Those two numbers let any reader reconstruct the test, sense its power, and judge whether a non-significant result means 'no change' or merely 'not enough data to see the change there was'. The p-value is the verdict; the ratio and n are the evidence, and evidence outlives verdicts in every serious archive.
FAQs
What chi-square statistic does the first example give?
Chi-square = 29 x 18.5 / 12.25 = 43.80 on 29 degrees of freedom, from a variance ratio of 1.510.
What is its two-sided p-value?
The two-sided p-value is 0.0767 - suggestive of a larger variance, but not significant at the 5% level.
What variance ratio does the first example use?
The ratio is 1.510: the sample variance of 18.5 is about half again the hypothesised 12.25.
What statistic does the matching second example give?
It gives 49.00 on 50 degrees of freedom with p = 0.9730 - a sample variance of 9.8 against a hypothesised 10 is fully compatible.
What statistic does the inflated third example give?
It gives 35.63 on 19 degrees of freedom, p = 0.0235: a ratio of 1.875 is significant even in a sample of 20.
How many degrees of freedom does the first example have?
It has 29 - one fewer than the 30 observations, as always for a sample variance.