Skip to main content
v2026.11,986 entries · CC-BY 4.0

ANOVA Hypothesis Testing: Variance Partitioning, Formulas, and Worked Example

Master ANOVA hypothesis testing with step-by-step variance partitioning formulas, a verified numerical example, APA 7th reporting, and code in R and Python.

Written and maintained by CASRAI Editorial Board

Published

On this page

ANOVA hypothesis testing is an inferential statistical procedure used to determine whether statistically significant differences exist between the population means of three or more independent groups by partitioning total sample variability into between-group variation and within-group error variation. Rather than performing multiple pairwise comparisons that inflate familywise Type I error rates, analysis of variance calculates an omnibus F-ratio of between-group mean square to within-group mean square. Under the null hypothesis that all population means are identical, the expected F-statistic is approximately 1.0, whereas genuine treatment effects systematically inflate the between-group mean square, yielding an F-ratio significantly greater than 1.0.

What is an ANOVA test for?

An ANOVA (Analysis of Variance) test evaluates whether empirical observations provide sufficient evidence to reject the hypothesis that multiple population means are identical. When evaluating three or more experimental cohorts, running repeated two-sample Student’s t-tests creates familywise error rate inflation.

When conducting hypothesis testing for anova models, evaluating k distinct groups requires m separate pairwise comparisons:

m = k × (k − 1) / 2

At a nominal significance threshold of α = 0.05, the cumulative probability of committing at least one Type I error across the test family escalates according to:

αfamilywise = 1 − (1 − α)m

For four conditions, 6 pairwise comparisons yield a cumulative false positive risk of 1 − (0.95)6 = 0.2649 (26.5%). For five groups, 10 comparisons generate a 40.1% false positive risk. ANOVA eliminates this problem by executing a single omnibus test that evaluates all group means simultaneously under one theoretical distribution, preserving the nominal Type I error rate. Methodologists reviewing the foundational analysis of variance definition rely on this omnibus property to confirm whether any treatment divergence exists before conducting pairwise follow-ups.

Number of Groups (k) Pairwise Comparisons (m) Nominal Alpha (α) Familywise Error Rate (αFW)
2 1 0.05 5.0%
3 3 0.05 14.3%
4 6 0.05 26.5%
5 10 0.05 40.1%
6 15 0.05 53.7%

How to test a hypothesis in statistics?

Hypothesis testing in statistics is a standardized inferential protocol that determines whether sample observations represent genuine population phenomena or random sampling noise. Parametric hypothesis testing anova workflows follow a five-stage decision sequence:

  1. State the formal hypotheses: Formulate a null hypothesis (H0) representing no effect or equality, paired with an alternative hypothesis (Ha) representing the research effect.
  2. Establish the significance threshold: Set the Type I error tolerance (α) prior to data collection, conventionally fixed at α = 0.05 in general research or α = 0.01 in clinical protocols.
  3. Collect sample data and verify assumptions: Gather random observations and execute diagnostics to verify independence, residual normality, and variance homogeneity.
  4. Compute the test statistic and p-value: Calculate the standardized sample statistic (the F-ratio in ANOVA) and determine the exact probability (p-value) under H0.
  5. Make a statistical decision: Compare the p-value against α (or F against critical Fcrit). If p ≤ α, reject H0; if p exceeds α, fail to reject H0.

Consulting the null hypothesis vs. alternative hypothesis framework confirms that failing to reject H0 does not prove equality; it demonstrates that observed discrepancies do not exceed chance variation.

How to make a hypothesis for ANOVA?

Formulating hypotheses for an ANOVA requires translating substantive research inquiries into mathematical statements concerning population parameters. Unlike directional two-sample tests, one-way ANOVA evaluates multiple means simultaneously using an omnibus formulation.

Null Hypothesis (H0)

In a one-way between-subjects ANOVA with k groups, the null hypothesis states that all group population means are equal:

H0: μ1 = μ2 = μ3 = … = μk

This posits that the grouping factor has no systematic influence on the continuous response metric. Observed sample mean differences are assumed to arise purely from random sampling variation.

Alternative Hypothesis (Ha)

The alternative hypothesis is non-directional and states that at least one group mean differs from the others:

Ha: At least one population mean differs (μi ≠ μj for at least one pair i ≠ j)

Writing Ha as μ1 ≠ μ2 ≠ … ≠ μk is incorrect because it requires all means to differ mutually. In reality, Ha is satisfied if only one single mean diverges from the rest. When defining the research hypothesis in ANOVA procedures, researchers recognize that a significant omnibus F-test indicates overall model significance without identifying which specific cohorts diverge.

ANOVA hypothesis testing formulas and variance partitioning

ANOVA partitions total sample variation into two independent sources: between-group variation and within-group error variation.

Sum of Squares Decomposition

The Total Sum of Squares measures overall squared dispersion of observations around the grand mean:

SSTotal = ∑j=1k ∑i=1nj (Xij − X̄grand)2

Where Xij is the i-th observation in group j, nj is group sample size, k is the number of groups, N = ∑ nj is total sample size, and X̄grand = (∑ ∑ Xij) / N is the grand mean.

The Between-Group Sum of Squares quantifies deviations of group means from the grand mean, weighted by cohort size:

SSBetween = ∑j=1k nj (X̄j − X̄grand)2

The Within-Group Sum of Squares captures residual variability around group means:

SSWithin = ∑j=1k ∑i=1nj (Xij − X̄j)2 = ∑j=1k (nj − 1) sj2

Total sum of squares equals the exact sum of between-group and within-group components: SSTotal = SSBetween + SSWithin.

Degrees of Freedom and Mean Squares

Degrees of freedom follow an identical additive partition. Mastering the degrees of freedom calculation in ANOVA establishes dimensional constraints for each component:

  • dfBetween = k − 1
  • dfWithin = N − k
  • dfTotal = N − 1 = dfBetween + dfWithin

Dividing sums of squares by degrees of freedom yields Mean Squares: MSBetween = SSBetween / (k − 1) and MSWithin = SSWithin / (N − k).

The test statistic is the variance ratio F = MSBetween / MSWithin. Under fixed-effects assumptions, E[MSWithin] = σ2. Under H0, E[MSBetween] also equals σ2, producing an expected F-value near 1.0. When treatment differences exist, treatment effects inflate MSBetween, shifting F above 1.0. Because treatment effects only increase the numerator, ANOVA is evaluated exclusively against the upper tail of the F-distribution.

Step-by-step worked example with real numbers

Consider an experiment evaluating three teaching methods (Method A: Standard Lecture, Method B: Active Learning, Method C: Self-Paced Modular) on exam performance across 15 students (k = 3, n = 5, N = 15) at α = 0.05.

Observed scores:

  • Method A (Group 1): 82, 86, 79, 83, 85
  • Method B (Group 2): 90, 88, 93, 87, 92
  • Method C (Group 3): 75, 78, 72, 80, 75

Arithmetic Walkthrough

  1. Group Means: X̄1 = 415 / 5 = 83.00; X̄2 = 450 / 5 = 90.00; X̄3 = 380 / 5 = 76.00; Grand Mean X̄grand = 1245 / 15 = 83.00.
  2. SSBetween: 5(83 − 83)2 + 5(90 − 83)2 + 5(76 − 83)2 = 5(0) + 5(49) + 5(49) = 490.00.
  3. SSWithin: Group 1 deviations sum = 30.00; Group 2 sum = 26.00; Group 3 sum = 38.00. SSWithin = 30.00 + 26.00 + 38.00 = 94.00.
  4. Total SS: SSTotal = 490.00 + 94.00 = 584.00.
  5. Degrees of Freedom and Mean Squares: dfBetween = 2, dfWithin = 12, dfTotal = 14. MSBetween = 490.00 / 2 = 245.00; MSWithin = 94.00 / 12 = 7.8333.
  6. F-Ratio and Decision: F = 245.00 / 7.8333 = 31.28. Critical F(2, 12) at α = 0.05 is 3.89; exact p = 0.000017 (p under 0.001). Because observed F (31.28) exceeds critical F (3.89), reject H0.
Source Sum of Squares df Mean Square F-Statistic p-value Critical F (α = 0.05)
Between Groups 490.00 2 245.00 31.28 under 0.001 3.89
Within Groups 94.00 12 7.83 — — —
Total 584.00 14 — — — —

Interpretation of ANOVA results and reading guidance

Statistical interpretation requires analyzing the omnibus F-statistic, the p-value, and standardized effect sizes to evaluate substantive importance.

Effect Size Quantification

While a significant p-value demonstrates non-chance differences, effect size metrics quantify the magnitude of the experimental effect. Standard guidelines for calculating effect size in ANOVA establish two primary metrics:

Eta-squared (η2) measures sample variance explained: η2 = SSBetween / SSTotal = 490.00 / 584.00 = 0.8390 (83.9% of score variance explained).

Omega-squared (ω2) provides an unbiased population estimate adjusting for sample size: ω2 = (SSBetween − dfBetween × MSWithin) / (SSTotal + MSWithin) = (490.00 − 15.6667) / 591.8333 = 0.8015 (80.2%).

Metric Threshold / Condition Statistical Inference Practical Action
F-Statistic Ratio F ≤ Fcrit (p exceeds α) Between-group variance is consistent with sampling error alone. Fail to reject H0; do not proceed with pairwise post-hoc tests.
F-Statistic Ratio F exceeds Fcrit (p ≤ α) Between-group variance significantly exceeds residual error. Reject H0; proceed with Tukey HSD or planned pairwise contrasts.
p-value p under 0.001 Extremely strong evidence against the null hypothesis. Report as p under .001 in APA format; verify model residuals.
Eta-Squared (η2) η2 ≥ 0.14 Large effect size; factor explains substantial outcome variance. Conclude high practical significance; examine confidence intervals.
Tukey HSD Post-Hoc Adjusted p ≤ 0.05 per pair Specific pair of group means demonstrates reliable divergence. Identify which specific teaching methods outperform others.

Assumptions and common mistakes in ANOVA hypothesis testing

ANOVA rests upon four core mathematical assumptions:

  • Independence of Observations: Observations within and across groups must be sampled independently. Violations inflate Type I error rates severely.
  • Continuous Response Scale: The dependent variable must be interval or ratio scale. Ordinal variables with few categories require non-parametric Kruskal-Wallis testing.
  • Normality of Residuals: Model residuals must follow a normal distribution. In balanced designs with n ≥ 20 per group, ANOVA is robust to moderate non-normality.
  • Homogeneity of Variances: Error variance must be equal across groups (tested via Levene’s test). Heteroscedasticity in unbalanced designs requires Welch’s adjusted ANOVA.

Common Methodological Mistakes

  1. Skipping the Omnibus Test: Running repeated pairwise t-tests instead of an initial ANOVA inflates familywise false positive rates.
  2. Over-Interpreting the Omnibus Result: Concluding that all groups differ when the F-test is significant without conducting post-hoc tests.
  3. Ignoring Unequal Variances: Proceeding with Fisher’s ANOVA when variances differ substantially across unequal group sizes instead of adopting Welch’s ANOVA.
  4. Misinterpreting Non-Significance: Treating p exceeding 0.05 as proof that group means are identical rather than acknowledging insufficient power.
  5. Neglecting Outlier Screening: Failing to inspect residual plots, allowing extreme data points to artificially inflate between-group variance.

How to report ANOVA hypothesis testing results in APA style

The American Psychological Association (APA 7th Edition) prescribes strict formatting rules for reporting inferential statistical analyses:

  • Italicize Latin statistical letters: F, p, M, SD, t. Keep Greek symbols unitalicized: α, η2, ω2.
  • Report degrees of freedom in parentheses: F(dfBetween, dfWithin).
  • Report test statistics and effect sizes to two decimal places (F = 31.28, η2 = .84).
  • Report p-values to two or three decimal places without leading zeros (p = .023; p under .001 for values below 0.001).

Example APA Results Paragraph

“A one-way between-subjects analysis of variance evaluated the effect of three teaching methodologies (Method A: Standard Lecture, Method B: Active Learning, Method C: Self-Paced Modular) on student exam performance. The data satisfied homogeneity of variance (Levene’s test, F(2, 12) = 0.38, p = .691). The omnibus ANOVA revealed a statistically significant main effect of teaching method, F(2, 12) = 31.28, p under .001, η² = .84, ω² = .80. Tukey HSD comparisons showed that Active Learning (M = 90.00, SD = 2.55) scored significantly higher than Standard Lecture (M = 83.00, SD = 2.74, p = .003) and Self-Paced Modular learning (M = 76.00, SD = 3.08, p under .001). Standard Lecture scored significantly higher than Self-Paced Modular learning (p = .004).”

Is ANOVA outdated in modern statistical analysis?

Classical ANOVA was developed by Sir Ronald Fisher in the 1920s for agricultural experiments with balanced blocks. In contemporary statistics, ANOVA is not outdated; rather, its specific role within the General Linear Model has been properly contextualized alongside modern modeling techniques.

Where Classical ANOVA Remains Optimal

  • Randomized Controlled Clinical Trials: Regulatory agencies such as the FDA and EMA routinely require ANOVA and ANCOVA models for multi-arm parallel randomized trials with balanced sample sizes.
  • Industrial Design of Experiments (DOE): Manufacturing and quality engineers rely on factorial ANOVA for transparent variance partitioning across production lines.
  • Methodological Transparency: ANOVA tables provide clear, interpretable sums of squares without relying on complex iterative estimation algorithms.

Modern Extensions That Expand Upon ANOVA

  • Linear Mixed-Effects Models (LMMs): When data involve repeated measures, unbalanced sample sizes, longitudinal tracking, or hierarchical clustering, LMMs supersede classical repeated measures ANOVA by handling missing data and avoiding sphericity assumptions.
  • Welch’s Heteroscedastic ANOVA: For observational studies with unequal variances, Welch’s ANOVA provides robust Type I error control without loss of statistical power.
  • Generalized Linear Models (GLMs): For binary, count, or categorical outcomes, GLMs extend variance analysis beyond normal distribution assumptions.
  • Bayesian ANOVA: Provides direct posterior probability distributions and Bayes factors, avoiding common misinterpretations of frequentist p-values.

Software implementations: Excel, R, and Python

Standard statistical software calculates ANOVA tables with minimal syntax:

Excel Implementation

  • Data Analysis ToolPak: Select Data → Data Analysis → Anova: Single Factor. Input range: A1:C6 (labels in first row), Alpha = 0.05.
  • Formula Functions:
    • Critical F-value: =F.INV.RT(0.05, 2, 12) (returns 3.885)
    • Exact p-value: =F.DIST.RT(31.28, 2, 12) (returns 0.000017)

R Implementation

scores = c(82, 86, 79, 83, 85, 90, 88, 93, 87, 92, 75, 78, 72, 80, 75)
method = factor(rep(c("Method_A", "Method_B", "Method_C"), each = 5))
df = data.frame(method, scores)

anova_model = aov(scores ~ method, data = df)
summary(anova_model)

TukeyHSD(anova_model)

Python Implementation

import scipy.stats as stats
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols

method_a = [82, 86, 79, 83, 85]
method_b = [90, 88, 93, 87, 92]
method_c = [75, 78, 72, 80, 75]

f_stat, p_val = stats.f_oneway(method_a, method_b, method_c)
print(f"SciPy: F = {f_stat:.2f}, p-value = {p_val:.6f}")

df = pd.DataFrame({
    'scores': method_a + method_b + method_c,
    'method': ['Method_A']*5 + ['Method_B']*5 + ['Method_C']*5
})
model = ols('scores ~ C(method)', data=df).fit()
print(sm.stats.anova_lm(model, typ=1))

Frequently asked questions

What is an ANOVA test for?

An ANOVA test evaluates whether statistically significant differences exist among three or more group population means. By testing between-group variance against within-group error, it performs an omnibus test without inflating familywise Type I error.

Is ANOVA outdated?

No, ANOVA is not outdated. It remains the regulatory gold standard in clinical trials, manufacturing, and balanced experiments. Linear mixed models extend ANOVA for longitudinal or clustered data, but ANOVA remains fundamental.

How to test a hypothesis in statistics?

Testing a hypothesis involves stating null (H0) and alternative (Ha) hypotheses, choosing a significance level (α = 0.05), gathering sample data, calculating the test statistic and p-value, and rejecting H0 if p ≤ α.

How to make a hypothesis for ANOVA?

In one-way ANOVA, the null hypothesis specifies equal population means: H0: μ1 = μ2 = … = μk. The alternative hypothesis specifies that at least one mean differs: Ha: at least one μj differs.

What is the difference between one-way ANOVA and two-way ANOVA?

One-way ANOVA assesses the effect of a single categorical factor on a continuous response. Two-way ANOVA evaluates two categorical factors simultaneously, measuring main effects for both factors and their interaction effect.

What should you do if the ANOVA assumption of equal variances is violated?

When variance homogeneity is violated, use Welch’s ANOVA, which adjusts degrees of freedom to control Type I error rates. Subsequent pairwise comparisons should be conducted using the Games-Howell post-hoc test.

Sources

Data: Statistical Performance and Robustness of ANOVA Procedures Across Design Conditions

Comparison of parametric one-way ANOVA with Welch ANOVA, Kruskal-Wallis, Repeated Measures ANOVA, and Linear Mixed Models across variance equality, distribution robustness, sample balance, and post-hoc protocols, compiled from NIST and OpenStax statistical standards.

Period covered: 2024/2026. Coverage: Global.

Statistical Performance and Robustness of ANOVA Procedures Across Design Conditions
ProcedureDesign TypeVariance AssumptionNormality RobustnessTest StatisticDegrees of FreedomPrimary Post-Hoc Test
Classical One-Way ANOVABetween-subjectsStrict (Homoscedasticity required)Robust for symmetric distributions when sample sizes are equalF-ratio (MS_Between / MS_Within)k - 1, N - kTukey HSD or Bonferroni
Welch One-Way ANOVABetween-subjectsRobust (Heteroscedasticity permitted)Robust against moderate non-normality and unequal variancesAdjusted F-ratio (Welch F)k - 1, Welch-Satterthwaite dfGames-Howell
Kruskal-Wallis TestBetween-subjectsNonparametric (Distribution shapes must be similar)Distribution-free rank test (No normality assumption)H-statistic (Chi-square approximation)k - 1Dunn test with Bonferroni correction
Repeated Measures ANOVAWithin-subjectsSphericity required (Mauchly test)Sensitive to sphericity violations; requires Greenhouse-Geisser adjustmentF-ratio (MS_Conditions / MS_Error)k - 1, (k - 1)(n - 1)Bonferroni or Holm-Bonferroni adjusted paired t-tests
Linear Mixed-Effects ModelBetween- or within-subjectsFlexible covariance structure (Heterogeneous residual variances permitted)Asymptotically robust with Kenward-Roger or Satterthwaite approximationsWald F-test or Likelihood Ratio TestKenward-Roger or Satterthwaite estimated dfEstimated marginal means with Tukey adjustment

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about ANOVA Hypothesis Testing: Variance Partitioning, Formulas, and Worked Example

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →