F-TEST CALCULATOR

F-test for two variances

Do two samples have the same spread? F, the p-value and the decision.

Sample 1

Sample 2

What is the F-test for two variances?

A test of whether two populations have the same variance, from two independent samples. The statistic is the ratio of the sample variances, F = s₁² ÷ s₂², with n₁ − 1 and n₂ − 1 degrees of freedom. If the variances are equal, F should be close to 1; far above or below 1 is evidence they differ.

Example from the NIST handbook

Two batches of 240 measurements in NIST’s JAHANMI2 data set have standard deviations 65.54909 and 61.85425. F = 65.54909² ÷ 61.85425² = 1.123037 with 239 and 239 degrees of freedom. At α = 0.05 the two-tailed critical values are 0.7756 and 1.2894, so there is not enough evidence that the variances differ.

Example: a one-tailed test

Two instructors each grade 30 students; the grade variances are 52.3 and 89.9. To test whether the first instructor’s variance is smaller, F = 52.3 ÷ 89.9 = 0.5818 with 29 and 29 degrees of freedom, and the left-tailed p-value is 0.0753 — below α = 0.10, so the first variance is smaller at the 10% level (OpenStax Introductory Statistics 2e, Example 13.5).

How is the two-tailed p-value calculated?

The F distribution is not symmetric, so the two-tailed p-value doubles the smaller tail: 2 × min(P(F ≤ f), P(F ≥ f)), the same rule R’s var.test uses. It does not matter which sample you call 1 — swapping them turns F into 1 ÷ F and gives the same two-tailed p-value.

What does the F-test assume?

Both samples are independent and come from normally distributed populations. OpenStax warns that the test is very sensitive to departures from normality, so a small p-value from skewed or heavy-tailed data may reflect the shape of the data rather than a difference in spread.

Where do the formulas come from?

The test is described in OpenStax Introductory Statistics 2e, section 13.4 “Test of Two Variances”, and in the NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.9. P-values and critical values come from the F distribution through the regularized incomplete beta function. Both books’ examples are part of this calculator’s automated tests.

Do I enter standard deviations or variances?

The statistic is a ratio of variances, so if you only have standard deviations, square them first. For SDs of 4.2 and 3.1 the variances are 17.64 and 9.61, and F = 1.836. Taking the ratio of the SDs instead (1.355) is a different number and gives the wrong p-value.

Should I run an F-test before a t-test?

It is common in textbooks, but the F-test is the most sensitive of the usual tests to non-normal data, so it can reject or accept for the wrong reason. Many analysts skip the pre-test and use the unequal-variance (Welch) version of the t-test, which does not require equal variances.

Setting up the test

The null hypothesis is that the two population variances are equal. The statistic is F = s₁² ÷ s₂² with n₁ − 1 numerator and n₂ − 1 denominator degrees of freedom. A two-tailed test asks whether the variances differ in either direction; a one-tailed test asks whether the first is larger (or smaller) than the second and must be chosen before you look at the data. The decision compares the p-value with α, or F with the critical values.

Worked example: two production lines

Line A has a sample SD of 4.2 from 15 parts and line B has 3.1 from 12 parts. The variances are 17.64 and 9.61, so F = 1.836 with 14 and 11 degrees of freedom. The two-tailed p-value is 0.316, so at α = 0.05 there is not enough evidence that the variances differ. The one-tailed p-value for the claim that line A is more variable is 0.158. Swapping the labels gives F = 0.545 and the same two-tailed p-value of 0.316.

Common mistakes

A non-significant F-test does not show that the variances are equal; with small samples it simply has little power to detect a difference. Using standard deviations in place of variances is a second, and applying the test to skewed or heavy-tailed data a third, because the normality assumption matters much more here than for a test of means. Finally, F-tests in ANOVA and regression use a different setup (a ratio of mean squares); this page tests exactly two sample variances.

Sources: OpenStax Introductory Statistics 2e, section 13.4 (test of two variances); NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.9 (F-test for equality of two standard deviations). Related: t-test calculator, ANOVA calculator, critical value calculator and standard deviation calculator.