Statistical Methods Atlas
Atlas › Compare Groups › ANCOVA (Analysis of Covariance)

ANCOVA (Analysis of Covariance)

Compares group means on an outcome while statistically controlling one or more continuous covariates — e.g., post-training performance controlling for pre-training scores.

Compare GroupsMultivariate also known as: Covariance analysis

✓ When to use

  • You want group comparisons purified of a nuisance continuous variable (baseline score, age, tenure).
  • Randomized experiments with a baseline measure: ANCOVA on post-scores controlling baseline is more powerful than gain-score comparisons.
  • Reducing error variance to sharpen the group effect.

✗ When NOT to use

  • In non-randomized designs where groups differ substantially on the covariate — 'controlling' cannot fix selection (Lord's paradox); interpret with great caution.
  • The covariate is affected by the treatment (a mediator) — controlling it removes part of the effect you want.
  • The covariate–outcome slope differs across groups (violated homogeneity of regression slopes) — model the interaction instead.
  • Categorical covariates — those are factors, not covariates.

Data requirements

Dependent / outcome variableOne continuous outcome.
Independent / grouping variableOne (or more) categorical factor(s), plus one or more continuous covariates measured before/independently of treatment.
DesignBetween-subjects with covariate(s).
Sample size guidanceAs for ANOVA plus a few cases per covariate; covariates that correlate with the DV raise power.

Assumptions

Hypotheses

H₀ — Adjusted population means (at the mean of the covariate) are equal across groups.
H₁ — At least one adjusted mean differs.

The concept

ANCOVA fits a regression of the outcome on the covariate, then compares the group means of the residual — what is left after the covariate has explained its share. Equivalently, it compares 'adjusted means': the outcome each group would show if all groups sat at the same covariate value.

Two benefits follow: the error term shrinks (more power) and baseline imbalances are partially adjusted. The critical diagnostic is homogeneity of regression slopes — if the covariate's effect differs across groups, one adjusted comparison cannot summarize the data, and the interaction is itself the finding.

Worked example

Three training formats (in-person, e-learning, blended; n = 30 each) are compared on post-test performance, controlling pre-test scores.

The format × pretest interaction is non-significant (p = .61) — slopes are homogeneous. ANCOVA: F(2, 86) = 5.61, p = .005, ηp² = .115; adjusted means favor blended (75.8) over e-learning (70.1), Bonferroni p = .004.

How to run it

# 1. Test homogeneity of slopes (interaction should be n.s.)
summary(aov(post ~ format * pre, data = df))

# 2. ANCOVA
model <- aov(post ~ pre + format, data = df)
car::Anova(model, type = 3)

library(effectsize); eta_squared(model, partial = TRUE)
library(emmeans)
emmeans(model, ~ format) |> pairs(adjust = "bonferroni")  # adjusted means

Interpreting the output

APA-style reporting

After confirming homogeneity of regression slopes, a one-way ANCOVA controlling for pre-test scores revealed a significant effect of training format on post-test performance, F(2, 86) = 5.61, p = .005, ηp² = .12. Adjusted means indicated higher performance for blended learning (Madj = 75.8) than e-learning (Madj = 70.1), p = .004.

Common mistakes

Related methods

One-Way ANOVANo covariateMultiple Linear RegressionThe general frameworkTwo-Way ANOVASecond categorical factorMediation AnalysisWhen the 'covariate' transmits the effect
← Repeated-Measures ANOVAMANOVA (Multivariate ANOVA) →