Hypothesis tests

Variance Hypothesis Test Calculator

Test stability and variability in one or two groups.

Parameters

Online calculator that computes the statistic, the p-value and the decision for tests on one variance or on two variances.

Result pending…

Rejection regions and observed statistic

What are tests for variances?

They are the tests that deal with the variability of the data, not with its average. In many problems, spread is precisely what matters: a packing machine may fill the correct 500 g on average and still be unacceptable if some bags come out at 480 g and others at 520 g. Variability measures how consistent a process is, how precise a measuring instrument is, or how risky an investment is.

This calculator covers the two basic cases:

  • One variance: does the variance of a population equal a reference value \(\sigma_0^2\)? The chi-square distribution is used.
  • Two variances: do two populations have the same variance? Snedecor's F distribution is used. There is a more detailed explanation in the two-variance test.

Remember that variance is in squared units (g², mm²); the standard deviation, its square root, is in the original units. The calculator asks for variances: if you have the standard deviation \(s\), enter \(s^2\).

Test for one variance

\(H_0: \sigma^2 = \sigma_0^2\)

\(H_1: \sigma^2 \neq \sigma_0^2\), \(\sigma^2 > \sigma_0^2\) or \(\sigma^2 < \sigma_0^2\)

\( \chi^2 = \dfrac{(n-1)\,s^2}{\sigma_0^2}, \quad df = n - 1 \)

  • \(s^2\): sample variance.
  • \(\sigma_0^2\): variance stated by the null hypothesis.
  • \(n\): sample size.

The statistic compares the observed variance with the reference one: if \(H_0\) is true, \(s^2/\sigma_0^2\) is around 1 and the statistic is around its degrees of freedom, \(n-1\). If the data are normal, it follows a chi-square distribution with \(n-1\) degrees of freedom.

The chi-square distribution is not symmetric, so the two-tailed test has two different critical values, one in each tail, which can be looked up in the chi-square table. In practice, the most common test is the right-tailed one: the usual concern is that variability is larger than allowed.

Test for two variances

\(H_0: \sigma_1^2 = \sigma_2^2\)

\( F = \dfrac{s_1^2}{s_2^2}, \quad df_1 = n_1 - 1, \quad df_2 = n_2 - 1 \)

If the two populations have the same variance, the ratio of sample variances is around 1; the further from 1, the more evidence against \(H_0\). With normal data, the ratio follows Snedecor's F distribution, whose critical values are in the F table.

Decision rule

  • If the p-value is less than \(\alpha\), \(H_0\) is rejected.
  • If the p-value is greater than or equal to \(\alpha\), there is not enough evidence to reject \(H_0\).
  • Not rejecting \(H_0\) does not prove that the variance equals the reference value, or that two variances are equal.

The normality assumption matters a lot

Tests for means tolerate non-normal data well, thanks to the central limit theorem. Tests for variances do not: both the chi-square and the F test depend on the data following a normal distribution, and that dependence does not go away as the sample grows. With heavy-tailed distributions (more extreme values than a normal), they reject \(H_0\) much more often than \(\alpha\) indicates, even if the variance is correct.

  • Check normality before using them, with a histogram or the Shapiro-Wilk test.
  • Check for outliers: because values are squared, a single extreme observation inflates the variance.
  • To compare two or more variances with non-normal data, Levene's test (or its Brown-Forsythe variant, based on the median) is preferable, as it is much more robust.

The other assumptions are the usual ones: a random sample, independent observations and, for two variances, groups independent of each other.

Worked example 1: one variance, two-tailed test

A process is set to produce parts with a variance of \(\sigma_0^2 = 10\) mm². A sample of \(n = 25\) parts gives \(s^2 = 14\) mm². Has the variability changed? We test \(H_0\colon \sigma^2 = 10\) against \(H_1\colon \sigma^2 \neq 10\) with \(\alpha = 0.05\).

\( \chi^2 = \dfrac{24 \times 14}{10} = 33.6 \)

With 24 degrees of freedom, the critical values are 12.40 and 39.36. Since \(12.40 < 33.6 < 39.36\), the statistic does not fall in the rejection region; the p-value is \(p \approx 0.184\). \(H_0\) is not rejected.

Conclusion: there is not enough evidence that the variance has changed. But the 95% confidence interval for \(\sigma^2\) runs from 8.5 to 27.1 mm²: it is compatible with 10 and also with a variance almost three times larger. Variances are estimated much less precisely than means: with 25 parts, the test detects with 80% probability only a standard deviation at least 1.48 times the reference one (or 0.65 times or less).

In the calculator: "One variance vs. a reference value", n = 25, s² = 14, σ₀² = 10 and "Two-sided (≠)". These are the values the page opens with.

Worked example 2: one variance, right tail

A packing machine must fill bags with a standard deviation of at most 2 g (\(\sigma_0^2 = 4\) g²). A sample of \(n = 30\) bags gives \(s^2 = 6.5\) g² (\(s \approx 2.55\) g). The only concern is variability above the limit: \(H_0\colon \sigma^2 = 4\) against \(H_1\colon \sigma^2 > 4\), with \(\alpha = 0.05\).

\( \chi^2 = \dfrac{29 \times 6.5}{4} = 47.125 \)

The right-tailed critical value with 29 degrees of freedom is 42.56 and the p-value is \(p \approx 0.018\). \(H_0\) is rejected: there is evidence that variability exceeds the limit. The 95% interval for the standard deviation runs from 2.03 to 3.43 g.

In the calculator: n = 30, s² = 6.5, σ₀² = 4 and "Right tail (>)".

Worked example 3: two variances

The variability of two production lines is compared. Line 1: \(s_1^2 = 16\) with \(n_1 = 20\). Line 2: \(s_2^2 = 9\) with \(n_2 = 18\). The statistic is \(F = 16/9 \approx 1.78\) with 19 and 17 degrees of freedom; the two-tailed critical values are 0.39 and 2.63, and the p-value is \(p \approx 0.238\). \(H_0\) is not rejected: there is no evidence that the variances differ, although with these sizes the test reliably detects only standard deviations that differ by a factor of almost 2.

In the calculator: "Comparison of two variances", n₁ = 20, n₂ = 18, s₁² = 16 and s₂² = 9.

How to interpret the result

Rejecting \(H_0\) (p-value < α) indicates that variability differs from the reference value, or between the two groups. To judge by how much, look at the ratio of variances and, better still, that of standard deviations, which is in the units of the data: twice the variance means a standard deviation only 41% larger.

Not rejecting \(H_0\) does not prove that variability is as expected. Confidence intervals for a variance are very wide with small samples, as in example 1.

In the calculator, the result shows the decision with the p-value, the statistic with its degrees of freedom and a sentence stating the conclusion. On the chart, the green area is the non-rejection region, the red areas are the critical regions and the amber line marks the statistic. Under "Calculation details" you will find the critical values and the confidence intervals for the variance and the standard deviation.

Power and minimum detectable ratio

Below the conclusion, the calculator shows the minimum detectable ratio: how many times larger (or smaller) than the reference the true standard deviation must be for the test to detect it with 80% probability. The link opens the sample size calculator for one variance or for two variances with your α and the type of test. For reference, detecting a standard deviation 50% larger than the reference takes about 24 observations; one 20% larger, more than 100.

Confidence interval

In the one-variance test, the other link opens the confidence interval for the variance with your data. In the two-tailed test, \(H_0\) is rejected exactly when \(\sigma_0^2\) lies outside the interval.

Common mistakes

  • Entering standard deviations instead of variances: the calculator asks for \(s^2\) and \(\sigma_0^2\).
  • Applying these tests to non-normal data without checking.
  • Using the F test to choose between Student's t and Welch's t: it is not good practice; use Welch directly.
  • Concluding that variability is correct because the test is not significant.
  • Forgetting that the chi-square and F distributions are not symmetric when looking up two-tailed critical values.

Frequently asked questions

  • When is a variance tested? When variability is what matters: the consistency of a process, the precision of an instrument or compliance with a tolerance.
  • Which distribution is used? Chi-square with n − 1 degrees of freedom for one variance, and Snedecor's F to compare two.
  • Variance or standard deviation? The calculator asks for variances. If you have the standard deviation, square it. Testing σ² = σ₀² is the same as testing σ = σ₀.
  • What if the data are not normal? These tests stop being reliable, even with large samples. To compare variances, use Levene's test.
  • Why are there two different critical values in the two-tailed test? Because the chi-square and F distributions are not symmetric: the critical value of each tail is computed separately.
  • What is the minimum detectable ratio? How many times larger or smaller than the reference the true standard deviation must be for the test to detect it with 80% probability.
  • How much data do I need? More than for a mean: to detect a standard deviation 50% larger than the reference, about 24 observations; for one 20% larger, more than 100.

Reference: Chi-squared test — Wikipedia