Parameters
Enter the sample variances and sample sizes of the two groups. The calculator computes the F statistic, the p-value, the critical values and the decision at the chosen significance level.
Number of observations in group 1. It determines the numerator degrees of freedom: df₁ = n₁ − 1.
Number of observations in group 2. It determines the denominator degrees of freedom: df₂ = n₂ − 1.
Variance observed in the sample from group 1. It goes in the numerator of the statistic F = s₁²/s₂².
Variance observed in the sample from group 2. It goes in the denominator of the statistic F = s₁²/s₂².
Probability of rejecting H₀ (equality of variances) when it is actually true. The usual value is 0.05.
Two-tailed assumes no direction. If you want to test that σ₁² > σ₂², use right-tailed with the group 1 variance in the numerator; for σ₁² < σ₂², use left-tailed.
Rejection regions and observed statistic
What is a hypothesis test for two variances?
It is the procedure for deciding whether two independent populations have the same variability. It is known as Snedecor's F test (or the Fisher-Snedecor test) of equality of variances. It answers questions such as: is one machine more consistent than another? Does one instrument measure more precisely than another? Are the grades of one group more homogeneous than those of another? Is one investment more volatile than another?
The idea is very direct: one sample variance is divided by the other. If the two populations have the same variance, the ratio should be around 1; the further it is from 1, the more evidence that the variabilities differ.
Hypotheses and test statistic
\(H_0: \sigma_1^2 = \sigma_2^2\)
\(H_1: \sigma_1^2 \neq \sigma_2^2\), \(\sigma_1^2 > \sigma_2^2\) or \(\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 \)
- \(s_1^2, s_2^2\): sample variances of the two groups.
- \(n_1, n_2\): group sizes.
- \(df_1, df_2\): numerator and denominator degrees of freedom.
If the data in both groups are normal and \(H_0\) is true, the statistic follows Snedecor's F distribution with \(df_1\) and \(df_2\) degrees of freedom. Order matters: the first degrees of freedom always belong to the variance in the numerator.
Critical values and tails
The F distribution is not symmetric: it only takes positive values and has a long right tail. That is why the two-tailed test has two different critical values, and the lower one is obtained from the F table with the relationship
\( F_{\alpha/2;\ df_1,\ df_2} = \dfrac{1}{F_{1-\alpha/2;\ df_2,\ df_1}} \)
Many textbooks avoid that step by always putting the larger variance in the numerator, so that \(F \geq 1\) and only the upper critical value is needed. The calculator does not need this: it computes both tails and accepts any order.
- Two-tailed: do the variances differ?
- Right tail: is the variance of group 1 greater?
- Left tail: is the variance of group 1 smaller?
Decision rule
- If the p-value is less than \(\alpha\), \(H_0\) is rejected: there is evidence that the variances differ.
- 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 variances are equal.
Assumptions: beware of normality
- Two independent samples, with independent observations within each one.
- Normal data in both groups. This is the critical assumption.
The F test is very sensitive to non-normality, and it does not improve as the sample grows. With heavy-tailed distributions, it can reject equality of variances two or three times as often as \(\alpha\) indicates, even when the variances are equal; in practice, it sometimes detects that the data are not normal rather than that the variances differ.
That is why it is worth checking the normality of each group (for example, with the Shapiro-Wilk test) and looking for outliers. If in doubt, the recommended alternative is Levene's test, or its Brown-Forsythe variant based on the median, which hardly depends on the shape of the distribution and also works for more than two groups.
Is it useful for choosing the test for means?
For years the F test was taught as a preliminary step to the two-means test: if equality of variances was not rejected, Student's t with a pooled variance was used; if it was rejected, Welch's. This is now discouraged: that two-stage procedure does not control the type I error well, and the F test has little power with small samples, precisely when it would be needed. The recommendation is to use Welch's test directly, which works well whether or not the variances are equal. The F test should be reserved for when variability is itself the question.
Worked example 1: two-tailed test
The variability of two production lines of metal parts is compared. Line 1: \(s_1^2 = 16\) mm² with \(n_1 = 20\) parts. Line 2: \(s_2^2 = 9\) mm² with \(n_2 = 18\) parts. We test \(H_0\colon \sigma_1^2 = \sigma_2^2\) against \(H_1\colon \sigma_1^2 \neq \sigma_2^2\) with \(\alpha = 0.05\).
\( F = \dfrac{16}{9} \approx 1.778, \quad df_1 = 19, \quad df_2 = 17 \)
The critical values are \(F_{0.025;\,19,\,17} \approx 0.39\) and \(F_{0.975;\,19,\,17} \approx 2.63\). Since \(0.39 < 1.778 < 2.63\), the statistic does not fall in the rejection region; the p-value is \(p \approx 0.238\). \(H_0\) is not rejected.
Conclusion: there is not enough evidence that the two lines differ in variability. But the 95% confidence interval for \(\sigma_1^2/\sigma_2^2\) runs from 0.68 to 4.56: it is compatible with equal variances and also with line 1 having a variance more than four times larger. With 20 and 18 parts, the test detects with 80% probability only standard deviations that differ by a factor of almost 2.
In the calculator: n₁ = 20, n₂ = 18, s₁² = 16, s₂² = 9 and "Two-tailed". These are the values the page opens with.
Worked example 2: one-tailed test
A laboratory suspects that an old instrument (group 1) measures less precisely than a new one (group 2). With 25 measurements of the same sample on each instrument, it obtains \(s_1^2 = 36\) and \(s_2^2 = 12\). We test \(H_0\colon \sigma_1^2 = \sigma_2^2\) against \(H_1\colon \sigma_1^2 > \sigma_2^2\) with \(\alpha = 0.05\).
\( F = \dfrac{36}{12} = 3.00, \quad df_1 = df_2 = 24 \)
The right-tailed critical value is \(F_{0.95;\,24,\,24} \approx 1.98\) and the p-value is \(p \approx 0.005\). \(H_0\) is rejected: there is evidence that the old instrument is less precise. Its standard deviation is about 1.7 times that of the new one (\(\sqrt{3} \approx 1.73\)), with a 95% interval for that ratio from 1.15 to 2.61.
In the calculator: n₁ = 25, n₂ = 25, s₁² = 36, s₂² = 12 and "Right tail".
How to interpret the result
Rejecting \(H_0\) (p-value < α) indicates that the two populations differ in variability, provided the data are normal. To judge by how much, the ratio of standard deviations is more intuitive than that of variances: an F of 4 means one standard deviation is twice the other.
Not rejecting \(H_0\) does not prove that the variances are equal. With small samples, the confidence interval for the ratio is very wide, as in example 1.
In the calculator, the result shows the decision with the p-value, the F statistic with its degrees of freedom and a sentence stating the conclusion. On the chart, the green area is the non-rejection region on the F distribution, 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 ratio of variances and of standard deviations.
Power and minimum detectable ratio
Comparing variabilities requires much more data than comparing means. Below the conclusion, the calculator shows the minimum detectable ratio: the ratio of standard deviations \(\sigma_1/\sigma_2\) closest to 1 that the test would detect with 80% probability given your sample sizes. The link opens the sample size calculator for two variances with your α and the type of test. For reference, in a two-tailed test with \(\alpha = 0.05\):
| Ratio of standard deviations to detect | Size needed per group (80% power) |
|---|---|
| 2 (one twice the other) | 19 |
| 1.5 | 50 |
| 1.25 | 160 |
Common mistakes
- Applying the F test to non-normal data: this is its weak point. Use Levene if in doubt.
- Entering standard deviations instead of variances.
- Using it as a preliminary step to the test for means instead of applying Welch directly.
- Swapping the degrees of freedom when reading the table: the numerator's come first.
- Concluding that the variances are equal because the test is not significant with small samples.
- Using it with paired data: the two samples must be independent.
Frequently asked questions
- What does the F test for two variances test? Whether two independent populations have the same variance, based on the ratio of the sample variances.
- Which variance goes in the numerator? That of group 1. You can use either; many textbooks put the larger one so that F is greater than 1 and only the upper critical value is needed.
- Why are there two different critical values? Because the F distribution is not symmetric. The lower one is the reciprocal of the upper one with the degrees of freedom swapped.
- What if the data are not normal? The F test stops being reliable, even with large samples. Use Levene's test or the Brown-Forsythe test.
- Should I run it before a two-means t-test? It is not recommended. It is better to use Welch's test directly, which does not assume equal variances.
- How do I interpret the value of F? It is the ratio of variances. Its square root is the ratio of standard deviations: F = 4 means one standard deviation is twice the other.
- What is the minimum detectable ratio? The ratio of standard deviations closest to 1 that the test would detect with 80% probability given your sample sizes.
- How much data do I need? Quite a lot: about 50 per group to detect that one standard deviation is 1.5 times the other, and about 160 per group for a ratio of 1.25.
Reference: F-test of equality of variances — Wikipedia