What Is an F-Test? (Definition)
Think of variance as a measurement of spread or consistency. Two groups might have identical means but very different levels of variability. A factory testing two production lines, a researcher comparing measurement instruments, or a statistician checking whether ANOVA assumptions hold — all need to answer the same question: are these two groups equally consistent, or is one significantly more variable than the other? The F-Test gives you a formal, probability-based answer.
The test was developed by Sir Ronald A. Fisher in the 1920s. Fisher named the ratio after himself — the "F" stands for Fisher. The F-distribution that governs the test is right-skewed, starts at zero (variances cannot be negative), and changes shape depending on the degrees of freedom in the numerator and denominator. Full background on the F-distribution is covered in the F-distribution guide on Statistics Fundamentals.
An F-Test is a hypothesis test that compares two population variances by computing F = s₁² / s₂². If F is large relative to the F critical value at the chosen significance level, the null hypothesis of equal variances is rejected. It is also used in ANOVA to test whether group means differ and in regression to test the overall model fit.
- Test statistic: F = s₁² / s₂² (place the larger variance in the numerator so F ≥ 1)
- H₀ (null hypothesis): σ₁² = σ₂² — the two population variances are equal
- H₁ (alternative hypothesis): σ₁² ≠ σ₂² (two-tailed) or σ₁² > σ₂² (one-tailed)
- Degrees of freedom: df₁ = n₁ − 1 (numerator); df₂ = n₂ − 1 (denominator)
- Distribution: F-distribution with df₁ and df₂
- Decision rule: Reject H₀ if F > F_critical, or if p-value < α
- Key assumption: Both populations must follow a normal distribution
- When to prefer an alternative: Use Levene's Test when normality is uncertain
The F-Test Formula and Degrees of Freedom
The F-statistic for a two-sample variance test is a ratio. The larger of the two sample variances goes in the numerator, which guarantees F ≥ 1 and simplifies the table lookup — you only need the upper-tail critical value.
s₁² = larger sample variance (numerator)
s₂² = smaller sample variance (denominator)
df₁ = n₁ − 1 (numerator degrees of freedom)
df₂ = n₂ − 1 (denominator degrees of freedom)
The sample variance for each group is computed as:
xᵢ = each observation
x̄ = sample mean
n = sample size
n − 1 = degrees of freedom (Bessel's correction)
Understanding Degrees of Freedom
Degrees of freedom (df) measure how many independent pieces of information went into each variance estimate. For a sample of n observations, computing the mean uses up one degree of freedom, leaving n − 1 for estimating variance. This matters because the F-distribution's shape — and therefore the critical values — changes with both df₁ and df₂.
| Component | Formula | Example (n₁ = 16, n₂ = 21) |
|---|---|---|
| Numerator df | df₁ = n₁ − 1 | df₁ = 15 |
| Denominator df | df₂ = n₂ − 1 | df₂ = 20 |
| F-critical (α = 0.05, two-tailed) | Look up F(df₁, df₂) at α/2 | F* ≈ 2.57 |
For a two-tailed test (H₁: σ₁² ≠ σ₂²), you split α equally between both tails. Since you placed the larger variance in the numerator, F ≥ 1, so you only compare to the upper-tail critical value at α/2. Look up F-distribution critical values using df₁ and df₂.
F-Test Assumptions
The F-Test's validity depends on four conditions. Meeting all four is non-negotiable — the test breaks down badly when the normality assumption is violated. This is the main reason Levene's Test is often preferred in practice. Review the full statistical test assumptions guide for a broader perspective.
Both populations are normally distributed
This is the most critical assumption. The F-Test is famously sensitive to non-normality — even modest skewness or outliers can distort the p-value substantially. Always check normality with Q-Q plots, the Shapiro-Wilk test, or the Anderson-Darling test before proceeding. See the normality testing guide.
The two samples are independent
Observations in Group 1 must be unrelated to observations in Group 2. If the same subjects appear in both groups (before/after measurements, matched pairs), the F-Test is not appropriate. Use the paired samples t-test framework instead.
Observations within each sample are independent
No observation should influence another within the same group. Time-series data with autocorrelation or clustered data violates this. Random sampling satisfies it in most cases.
Data is continuous and measured on an interval or ratio scale
Variance is meaningful only for continuous measurements. The F-Test cannot be applied to nominal or ordinal data. Weight, temperature, time, and test scores are appropriate; Likert-scale responses typically are not.
Simulation studies show the F-Test can have actual Type I error rates far above the nominal α when populations are not normal — even with reasonably large samples. If you are unsure about normality, use Levene's Test or the Brown-Forsythe Test instead. They are more robust to non-normality and almost always preferred for applied research.
How to Perform an F-Test: 5-Step Method
Step 1: State H₀ and H₁. Step 2: Check assumptions and calculate both sample variances. Step 3: Compute F = s₁²/s₂² (larger/smaller). Step 4: Find F_critical from the F-table using df₁ and df₂. Step 5: If F > F_critical (or p < α), reject H₀ and conclude the variances differ significantly.
State the Null and Alternative Hypotheses
H₀: σ₁² = σ₂² (the two population variances are equal). For a two-tailed test, H₁: σ₁² ≠ σ₂². For a one-tailed test, H₁: σ₁² > σ₂² (or <). Two-tailed tests are far more common in practice — use one-tailed only when you have a strong prior reason to expect one group to be more variable.
Check Assumptions and Set the Significance Level
Verify normality (Shapiro-Wilk, Q-Q plots), confirm independence, and set α. The conventional choice is α = 0.05. For applications with serious consequences (clinical trials, safety testing), use α = 0.01 for a stricter threshold. The significance level guide covers these tradeoffs in detail.
Calculate the F-Statistic
Compute both sample variances: s₁² = Σ(x − x̄)²/(n₁−1) and s₂² = Σ(x − x̄)²/(n₂−1). Place the larger variance in the numerator. Compute F = s₁²/s₂². This ensures F ≥ 1 and means you only need to compare against the upper-tail critical value.
Find the Critical Value and p-value
Compute df₁ = n₁ − 1 and df₂ = n₂ − 1. Look up F_critical in the F-distribution table at the appropriate α (use α/2 for two-tailed tests, since you placed the larger variance on top). Software will give you the exact p-value directly.
Make a Decision and State the Conclusion
If F > F_critical or p < α: "Reject H₀. At the α = 0.05 level, there is sufficient evidence that σ₁² ≠ σ₂² — the two populations have significantly different variances." If F ≤ F_critical: "Fail to reject H₀. The data does not provide sufficient evidence that the variances differ." Never write "accept H₀" — failing to reject is not proof of equality.
F-Test Worked Examples — 3 Fully Solved
Each example follows the same 5-step structure. All arithmetic is shown in full. Formula definitions follow the NIST Engineering Statistics Handbook standards for F-test notation.
Example 1 — Manufacturing Quality Control
Problem: A factory tests two filling machines. Machine A fills 16 bottles and records a sample variance of s₁² = 0.036 mL². Machine B fills 21 bottles with s₂² = 0.014 mL². At α = 0.05, do the machines differ significantly in filling consistency?
df₁ = 16 − 1 = 15
df₂ = 21 − 1 = 20
F_critical at α/2 = 0.025
Hypotheses: H₀: σ_A² = σ_B² | H₁: σ_A² ≠ σ_B² (two-tailed — testing for any difference in variance)
Assumptions and significance level: Both samples drawn independently; normality verified via Q-Q plots. α = 0.05, two-tailed, so look up F at α/2 = 0.025.
Calculate F-statistic:
Place larger variance in numerator: s₁² = 0.036 (Machine A) and s₂² = 0.014 (Machine B).
F = 0.036 / 0.014 = 2.571
Critical value:
df₁ = 16 − 1 = 15; df₂ = 21 − 1 = 20.
From the F-table at α/2 = 0.025: F_critical(15, 20) ≈ 2.57
Decision: F = 2.571 ≈ F_critical = 2.57. The test statistic sits right at the boundary. The p-value ≈ 0.050. At α = 0.05, we are at the edge — the decision depends on the exact F-table precision. With p ≈ 0.05, most researchers report this as borderline significant and would investigate further.
⚠️ Conclusion: The F-statistic (2.57) equals the critical value at the 5% level, placing this result exactly at the boundary of statistical significance. In practice, the quality team should collect more data or use Levene's Test to confirm whether Machine A is genuinely less consistent than Machine B.
Example 2 — Comparing Student Score Variability
Problem: A researcher compares exam score variability between two teaching methods. Class A (n = 25 students, s₁² = 144) vs. Class B (n = 31 students, s₂² = 49). Test whether Class A has significantly greater variance at α = 0.05 (one-tailed).
df₁ = 24 (Class A)
df₂ = 30 (Class B)
One-tailed: compare F to F_critical at α = 0.05
Hypotheses: H₀: σ_A² = σ_B² | H₁: σ_A² > σ_B² (one-tailed — the researcher predicts Class A is more variable)
α = 0.05, one-tailed. The direction is specified in advance: Class A is hypothesized to be more variable. So σ_A² goes in the numerator regardless of which is larger (here it is larger). Critical value comes from the α = 0.05 column (not α/2) of the F-table.
F-statistic:
F = s_A² / s_B² = 144 / 49 = 2.939
Critical value:
df₁ = 24; df₂ = 30.
From the F-table at α = 0.05: F_critical(24, 30) ≈ 1.89
Decision: F = 2.939 > F_critical = 1.89 → Reject H₀. The p-value ≈ 0.007, which is well below α = 0.05.
✅ Conclusion: At the 5% level, there is sufficient evidence that Class A exhibits significantly greater score variability than Class B (F(24,30) = 2.94, p ≈ 0.007). The teaching method associated with Class A produces less consistent outcomes, a finding with practical implications for instructional design.
Example 3 — Clinical Trial Measurement Consistency
Problem: A clinical trial compares two blood pressure measurement devices. Device X is tested on 11 patients (s₁² = 9.6 mmHg²); Device Y on 11 patients (s₂² = 3.2 mmHg²). Do the devices differ in measurement consistency? Test at α = 0.05, two-tailed.
df₁ = 11 − 1 = 10
df₂ = 11 − 1 = 10
F_critical at α/2 = 0.025
Hypotheses: H₀: σ_X² = σ_Y² | H₁: σ_X² ≠ σ_Y² (two-tailed — no prior expectation about direction)
α = 0.05, two-tailed. Normality checked for both groups (n = 11 each — small samples, so normality is especially important here). Critical value uses α/2 = 0.025.
F-statistic:
Larger variance: Device X, s₁² = 9.6.
F = 9.6 / 3.2 = 3.000
Critical value:
df₁ = df₂ = 10.
From the F-table at α/2 = 0.025: F_critical(10, 10) = 3.717
Decision: F = 3.000 < F_critical = 3.717 → Fail to Reject H₀. The p-value ≈ 0.125, which exceeds α = 0.05.
❌ Conclusion: The data does not provide sufficient evidence (p ≈ 0.125) to conclude that the two devices differ in measurement consistency. However, with only 11 patients per group, the test has limited statistical power. A larger study would be needed to detect smaller but potentially clinically meaningful differences in variance.
Free F-Test Calculator
Enter the sample variances and sizes for your two groups. The calculator computes the F-statistic, degrees of freedom, and approximate p-value, then displays a plain-English decision. For the critical value, consult the F-distribution table.
F-Test Calculator — Compare Two Variances
F-Distribution Curve (interactive result visualized above)
The shaded region represents the rejection area at α = 0.05 for F(10,10). Run the calculator to see your result plotted.
F-Test vs. Levene's Test vs. Bartlett's Test vs. Brown-Forsythe
Four tests can compare variances across groups, but they differ in when to use them and how sensitive they are to assumption violations. Choosing the right one depends on your sample size, data distribution, and tolerance for false positives.
| Feature | F-Test | Levene's Test | Bartlett's Test |
|---|---|---|---|
| Groups compared | 2 groups only | 2 or more groups | 2 or more groups |
| Normality required? | Yes — strictly | No — robust | Yes — strictly |
| Sensitive to outliers? | Very sensitive | Moderately sensitive | Very sensitive |
| Recommended when? | Data is clearly normal, 2 groups | Normality uncertain, any groups | Data is clearly normal, multiple groups |
| Software default? | Excel (F-Test option) | SPSS, R (car package) | R, SAS |
| ANOVA prerequisite? | Commonly used | Most common choice | Also used |
For most applied research, Levene's Test is the safer default when checking the equal-variance assumption before a t-test or ANOVA. Reserve the F-Test for situations where you have strong evidence of normality and are comparing exactly two groups. The Brown-Forsythe Test (a variant of Levene's using medians instead of means) is the most robust choice when outliers are a concern.
F-Test and ANOVA: What's the Connection?
ANOVA (Analysis of Variance) uses the same F-statistic to test whether group means differ — but for a different purpose. In ANOVA, the F-ratio compares variance between groups to variance within groups. In the two-sample variance test, the F-ratio compares the spread of two populations directly. The mathematics share the same distribution; the hypotheses differ.
When you run a one-way ANOVA, the F-test for variance equality (homogeneity of variance) is a prerequisite check — you verify equal variances first so that ANOVA's pooled error term is valid. If variances are unequal, Welch's ANOVA is the appropriate alternative. The full procedure is covered in the ANOVA guide.
How to Run an F-Test in Excel, R, and Python
F-Test in Excel
Excel has a built-in F-Test Two-Sample for Variances tool. Go to Data → Data Analysis → F-Test Two-Sample for Variances. Enter the two data ranges, the significance level, and choose an output location. Excel returns the F-statistic, p-value (one-tailed), and critical value. Note: Excel returns the one-tailed p-value, so multiply by 2 for a two-tailed test.
You can also use the F.TEST(array1, array2) function, which returns the two-tailed probability directly, or F.DIST(F, df1, df2, TRUE) for the cumulative distribution function.
F-Test in R
The var.test() function performs the F-Test in base R. The call is:
var.test(group1, group2, alternative = "two.sided")
# One-tailed (group1 has greater variance)
var.test(group1, group2, alternative = "greater")
# With raw variances and sample sizes
var.test(x = c(var1 = s1sq), df1 = n1-1, df2 = n2-1)
The output includes F, df, p-value, confidence interval for the variance ratio, and the alternative hypothesis. For Levene's Test in R, use leveneTest() from the car package.
F-Test in Python
from scipy import stats
# F-statistic (manual)
f_stat = np.var(group1, ddof=1) / np.var(group2, ddof=1)
df1 = len(group1) - 1
df2 = len(group2) - 1
# Two-tailed p-value
p_value = 2 * min(stats.f.cdf(f_stat, df1, df2),
1 - stats.f.cdf(f_stat, df1, df2))
# Levene's Test (preferred in practice)
stats.levene(group1, group2)
Python's scipy.stats library does not have a direct f_test function, but the F-statistic and p-value are straightforward to compute manually, as shown above. The SciPy statistics documentation covers stats.levene() and stats.bartlett() as alternatives.
Real-World Applications of the F-Test
The F-Test appears across manufacturing, healthcare, agriculture, and education wherever consistency and variability matter as much as average performance. Here are the most common applied contexts.
Manufacturing QC
Comparing the consistency of two machines, production lines, or suppliers. A machine producing consistent output is preferable even if both meet the mean specification.
Pharmaceutical Research
Testing whether two drug formulations produce equal variability in blood concentration levels. Consistency in dosage response is a regulatory requirement.
ANOVA Prerequisites
Checking homogeneity of variance before running one-way or two-way ANOVA. If variances are unequal across groups, Welch's ANOVA should be used instead.
Agricultural Experiments
Comparing yield variability across plots treated with different fertilizers or irrigation methods to assess process stability, not just average output.
Educational Assessment
Testing whether two classrooms, teaching methods, or schools produce equally consistent test score distributions — a measure of outcome equity.
Finance and Risk
Comparing the volatility (variance of returns) of two investment portfolios or financial instruments during different market periods.
Laboratory Testing
Evaluating whether two analytical instruments produce measurements with equivalent precision before selecting one for routine use in a diagnostic lab.
Process Improvement
In Six Sigma and lean manufacturing, comparing process variability before and after an improvement intervention to verify that the change reduced variance.
Case Study — Process Improvement
Did Six Sigma Training Reduce Assembly Line Variability?
A production manager at an electronics plant ran a Six Sigma improvement project targeting the time taken to assemble circuit boards. Before the project: n₁ = 20 assemblies, s₁² = 28.6 min². After: n₂ = 20 assemblies, s₂² = 11.4 min². F = 28.6/11.4 = 2.51. With df₁ = df₂ = 19 and α = 0.05 (one-tailed, since the project was designed to reduce variance), F_critical(19,19) = 2.17. Because F = 2.51 > 2.17, the manager rejects H₀ and concludes the Six Sigma project significantly reduced assembly time variability — a meaningful improvement in process control beyond the reduction in average time.
When to Use the F-Test: Decision Guide
F-Test Decision Framework
Common Mistakes When Using the F-Test
| Common Mistake | Wrong Approach | Correct Approach |
|---|---|---|
| Ignoring the normality assumption | Running F-Test on skewed or heavy-tailed data | Check Q-Q plots and Shapiro-Wilk first; use Levene's if normality fails |
| Placing smaller variance in numerator | F = s₂²/s₁² giving F < 1, then comparing to wrong tail | Always put the larger variance in the numerator so F ≥ 1 |
| Wrong α for two-tailed test | Using α = 0.05 column for a two-tailed F-test | Use α/2 = 0.025 column in the F-table for two-tailed tests |
| Wrong degrees of freedom | Using n₁ and n₂ directly as df | df₁ = n₁ − 1, df₂ = n₂ − 1 (always subtract 1) |
| "Accepting" H₀ | "The F-test proves the variances are equal" | "Fail to reject H₀ — insufficient evidence of a difference" |
| Using paired data | Comparing before/after variances with the standard F-Test | Paired variance tests require a different approach (e.g., Morgan-Pitman test) |
F-Test Glossary: Key Terms Defined
| Term | Symbol | Definition |
|---|---|---|
| F-Statistic | F | The ratio of two sample variances: F = s₁²/s₂². Values much greater than 1 suggest unequal population variances. |
| F-Distribution | F(df₁, df₂) | A right-skewed probability distribution defined by two degrees-of-freedom parameters. The F-statistic follows this distribution under H₀. |
| Variance | s² or σ² | The average squared deviation from the mean. Measures spread/dispersion. Sample variance uses n−1 (Bessel's correction); population variance uses N. |
| Variance Ratio | s₁²/s₂² | The F-statistic for comparing two variances. Equal to 1 when both samples have identical variance. |
| Homogeneity of Variance | — | The condition that two or more populations have equal variances. A prerequisite for standard t-tests and ANOVA. |
| Degrees of Freedom | df | The number of independent values used to estimate a parameter. For variance: df = n − 1. For F: two df values (numerator and denominator). |
| Critical Value | F_critical | The F-value from the F-table at which you reject H₀. Depends on α, df₁, and df₂. |
| p-value | p | The probability of observing an F-statistic as extreme as yours (or more extreme) if H₀ is true. Reject H₀ when p < α. |
| Significance Level | α | The pre-set probability threshold for rejecting H₀. Common values: 0.05, 0.01, 0.10. |
| Null Hypothesis | H₀ | For the F-Test: H₀: σ₁² = σ₂². The default assumption that the two population variances are equal. |
| Alternative Hypothesis | H₁ | The claim under test. Two-tailed: H₁: σ₁² ≠ σ₂². One-tailed: H₁: σ₁² > σ₂². |
| Type I Error | α | Rejecting H₀ when it is actually true (false positive). The probability of a Type I error equals α. |
| Statistical Significance | — | The result is unlikely under H₀ at the chosen α level. Statistical significance does not imply practical importance. |
Frequently Asked Questions About the F-Test
F-Test Cheat Sheet
| Item | Detail |
|---|---|
| Test statistic | F = s₁² / s₂² (larger variance in numerator) |
| Null hypothesis | H₀: σ₁² = σ₂² |
| Alternative (two-tailed) | H₁: σ₁² ≠ σ₂² |
| Alternative (one-tailed) | H₁: σ₁² > σ₂² |
| Numerator df | df₁ = n₁ − 1 |
| Denominator df | df₂ = n₂ − 1 |
| Two-tailed critical value | Look up F(df₁, df₂) at α/2 in F-table |
| One-tailed critical value | Look up F(df₁, df₂) at α in F-table |
| Reject H₀ when | F > F_critical, or p < α |
| Fail to reject H₀ when | F ≤ F_critical, or p ≥ α |
| Excel function | F.TEST(array1, array2) or Data Analysis → F-Test |
| R function | var.test(x, y, alternative = "two.sided") |
| Python (SciPy) | scipy.stats.levene(x, y) or manual F = var(x)/var(y) |
| Key assumption | Both populations normally distributed |
| Robust alternative | Levene's Test or Brown-Forsythe Test |