Method · Statistics Library

F-test for two variances

The F-test for two variances compares how spread out one measurement is in two groups by dividing one group's variance by the other's (a ratio near 1 means similar spread), gives a confidence interval for that ratio, and assumes both groups are normal, an assumption it is very sensitive to.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

The F-test divides one group's variance by the other's. (The variance is a measure of spread: the standard deviation squared.) A ratio near 1 means the two groups scatter about equally; a ratio far from 1 means one group is more spread out.

Its weak point is normality: if either group has more extreme values than a normal curve would give (heavy tails, common in skewed data), the F-test reports a difference far more often than it should; with fewer extreme values than normal it misses differences instead. A large sample does not fix either. For data that may not be normal, the Brown-Forsythe test (a Levene test using medians) is the safer choice.

A non-significant result means no clear evidence that the spreads differ; it does not show they are equal. The confidence interval for the ratio gives the values still compatible with the data.

Practitioner explanation

KernelStats takes group 1 as the first level of the group column in sorted order and computes R's var.test: F = (s₁²/s₂²)/ρ₀, p two-sided as twice the smaller tail or one-sided, and the interval [est/F_{1−α/2}, est/F_{α/2}] for σ₁²/σ₂² (a one-sided bound for a one-sided test); α = 1 − the confidence level. The card refuses a column without exactly two levels, a group with fewer than two values or no spread.

Each group gets a Shapiro-Wilk row; any departure raises a warning that names the Brown-Forsythe test, which the card shows under Alternative Tests together with mean-centered Levene. Before a two-sample t-test, use Welch's t-test directly rather than choosing between pooled and Welch from this test. The worked example's numbers agree with var.test in R 4.5.3.

When to use it

Consider it when

Two independent groups, one continuous measurement, data close to normal in each group, and a question about spread (precision of two instruments, consistency of two processes).

Use caution when

Skewed or heavy-tailed data, or unsure about normality (use the Brown-Forsythe or Levene option of the Equal Variances Test); three or more groups (use the Equal Variances Test); as a gate for choosing the pooled t-test (use Welch's t-test directly).

Formulas and symbols

F statistic

F=s12/s22ρ0∼F(n1−1, n2−1)F = \dfrac{s_1^2 / s_2^2}{\rho_0} \sim F(n_1 - 1,\, n_2 - 1)

s₁², s₂² the sample variances of group 1 and group 2, n₁, n₂ the group sizes, ρ₀ the hypothesized variance ratio (1 = equal variances).

Confidence interval for the variance ratio

[s12/s22F1−α/2(n1−1,n2−1),  s12/s22Fα/2(n1−1,n2−1)]\left[\dfrac{s_1^2/s_2^2}{F_{1-\alpha/2}(n_1-1, n_2-1)},\; \dfrac{s_1^2/s_2^2}{F_{\alpha/2}(n_1-1, n_2-1)}\right]

F_q(a, b) the F quantile with probability q below it.

Alternatives

  • Equal Variances Test (Equal Variances Test). Data that may not be normal (Brown-Forsythe, the default) or three or more groups; Analyze > Assumptions > Equal Variances Test.
  • Two-Sample t-Test, Welch (Two-Sample t-Test). The real question is about the means; Welch does not need equal variances.

Worked example

Scenario

Penguin body mass by sex (female 165, male 168), ratio 1, two-sided, 95%.

Result

F(164, 167) = 0.7154, p = 0.0320, 95% CI for σ²(female)/σ²(male) [0.5270, 0.9714]. Both groups fail Shapiro-Wilk; Brown-Forsythe W = 6.06, p = 0.014.

Interpretation

Male body mass is more spread out in this sample (its variance is 1.40 times the female variance); because body mass is not normal within each sex, the Brown-Forsythe result is the one to report, and it also finds a difference in spread (p = 0.014).

Dataset: penguins.csv

Common misconceptions

Misconception

With large samples the F-test is fine for non-normal data because of the central limit theorem.

Correction

The central limit theorem helps tests about means, not a ratio of variances; the F-test's error rate depends on how heavy the data's tails are (their kurtosis) and stays wrong for non-normal data at any sample size.

Misconception

A non-significant F-test shows the variances are equal.

Correction

It shows no clear evidence of a difference in spread. Read the interval for the ratio, and remember the test is weak with small groups.

References

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.9 F-Test for Equality of Two Variances, NIST/SEMATECH (2012).