ANOVA Family · General Linear Model
ANCOVA
ANCOVA compares group means after adjusting for another variable, like a pretest.
An ANCOVA takes one continuous outcome from two or more separate groups, plus a continuous covariate such as a pretest, and tests whether the groups' means differ once the covariate is accounted for.
Once we account for how anxious students were to begin with, does a brief session change their math anxiety? Eighty-four math-anxious undergraduates were randomly assigned, 28 each, to a control session, reappraisal training or expressive writing. Math anxiety (9–45) was measured before the session and two weeks after.
- Tests
- Differences among covariate-adjusted population means
- Observations
- Independent
- Parametric
- Yes
- Headline Statistic
- F
- Effect Size
- Generalized Eta Squared
- Groups
- 2+
The Basics
When to Use It
Use it when you have two or more separate groups, one continuous outcome, and a continuous covariate measured before the groups could affect it, usually a pretest. (With two groups, the F test equals the square of the t for the adjusted difference.) It works best in randomized experiments, where the covariate soaks up noise and evens out chance differences at the start. You can include more than one covariate. Each costs a degree of freedom, so choose a few that predict the outcome well and aren't strongly related to each other. For example:
- Once we account for how anxious students were to begin with, does a brief session change their math anxiety?
- Do depression scores after 12 weeks differ between CBT, medication and a waitlist, adjusting for baseline depression?
- Does reading comprehension differ across three teaching methods, adjusting for students' vocabulary scores at the start of the year?
Vocabulary You Need
Definition Covariate
A continuous variable that is related to the outcome but isn't the question of interest, such as a pretest score or age. Including it in the model sets aside the part of the outcome it predicts, which shrinks the unexplained variation and, when groups are compared, can adjust for small chance differences between them. In experiments it should be measured before any treatment, so the treatment can't have changed it. Glossary →
Definition Adjusted Mean (\bar{y}_j')
A group's mean outcome, moved along the within-group regression line to where it would sit if the group's covariate mean equaled the overall covariate mean: the group's mean minus the slope times how far its covariate mean is from the overall one. With a positive slope, groups that started higher on the covariate are nudged down and groups that started lower are nudged up; with a negative slope, it's the other way around. Also called the estimated marginal mean or least-squares mean. Glossary →
Definition Within-Groups Sum of Squares (SS_{\text{within}})
Each score's squared distance from its own group's mean, added up across all groups. It is the variation the grouping doesn't account for, also called the error or residual sum of squares. Glossary →
Definition Generalized Eta Squared (\eta^2_G)
An effect's sum of squares divided by itself plus every source of variation that doesn't come only from manipulated factors: stable differences between people, measured factors such as gender (and their interactions), covariates, and error. The other manipulated effects are left out. For manipulated factors, that makes it comparable between between-subjects and within-subjects designs, where partial eta squared isn't. In a design with only manipulated between-subjects factors and no covariate it equals partial eta squared. A covariate, a measured factor, or differences between people in a repeated-measures design stay in its denominator, so there it's smaller, often much smaller. Glossary →
Definition Partial Eta Squared (\eta^2_p)
An effect's sum of squares divided by that sum of squares plus its own error term's. It leaves out the other effects and, in designs with repeated measures, the stable differences between people, so each effect gets its own denominator. It equals eta squared in a one-way between-subjects design; otherwise it runs larger, and it doesn't add up across effects. It is what SPSS prints for ANOVAs. In MANOVA and MANCOVA there's no single sum of squares; SPSS's multivariate version is Pillai's trace divided by s, the number of dimensions the groups can differ along (V ÷ s). Don't convert a repeated-measures partial η² into Cohen's f for a power calculator that also asks for the correlation between measures: the correlation would be counted twice. Glossary →
Definition F Statistic (F)
The variance due to an effect divided by the error variance it is tested against: in a between-subjects ANOVA, the between-groups variance over the within-groups variance; in a repeated-measures ANOVA, the conditions' variance over the inconsistency in how people change across them. It is near 1 when there's no real effect and grows as the effect stands out from the error. It is compared with an F distribution, which has two degrees of freedom, to get a p-value. Glossary →
Assumptions and Inference
1. Independent Students (for the p-Values and Intervals) Each student's outcome is independent of everyone else's, after accounting for the model. Random assignment doesn't remove clustering within classrooms, therapy groups or other shared settings.
- What It Means
- Each person's data comes from a separate, unconnected source, so knowing one person's scores tells you nothing about anyone else's. In designs that measure people more than once, their own scores are meant to be related; it's different people who must be independent. Methods built for clustered data, such as multilevel models and GEE, also allow members of the same group to be related, as long as the analysis names the grouping; then it's the groups that must be independent.
- Applies To
- Observations
- How to Check
- By design, not by a test. Did each person contribute their own data, with no clusters such as roommates, couples, therapy groups or classrooms whose members influence each other? If there are clusters, does the analysis model every one of them?
- How Much It Matters
- A lot. If students did the session together or were recruited in clusters (a class, a dorm), their scores are more alike than the F-test expects, and p comes out too small.
What to Do
- Alternative Test Multilevel Regression (HLM). A multilevel model with the pretest as a predictor, which accounts for the clustering.
- Design Change Assign and measure each person separately, or analyze cluster averages.
2. A Pretreatment Covariate For a baseline-adjusted treatment comparison, the covariate is measured before the treatment could affect it. Adjusting for something the treatment changed alters the question and can bias the result.
- What It Means
- The covariate reflects where people started, not anything the treatment or group membership did to them. That's guaranteed when it's measured before random assignment. If the groups differ on the covariate for real reasons (pre-existing groups, or a covariate the treatment changed), adjusting for it changes the question rather than answering it.
- Applies To
- Design
- How to Check
- By design, not by a test. Was the covariate measured before assignment, and were people randomized? A test of group differences on the covariate can't show that pre-existing groups are equivalent; with random assignment, any differences are chance.
- How Much It Matters
- Decisive, for what the result means. If the covariate was measured after the sessions, the adjustment can remove part of the effect you're testing. If the groups weren't randomized and differ on the covariate, the adjustment usually can't make them equivalent (Miller & Chapman, 2001). Assignment by the covariate itself, such as giving the session to everyone above a cutoff, is a different case: it's a regression-discontinuity design, where ANCOVA can be unbiased (Van Breukelen, 2006), but only if the model's line is right across the cutoff, and the effect it estimates is mainly about people near it. It isn't a substitute for randomization. The covariate also needs to be measured reliably. Measurement error flattens its slope, so the adjustment is too small: with random assignment that only costs power, but with groups that differ on the covariate it leaves part of the starting difference in the result. The AMAS has good internal consistency and test–retest reliability (Hopko et al., 2003). In the math-anxiety study the pretest came first and assignment was random; the three pretest means (26.50, 27.00, 27.50) are within a point of each other, as expected under random assignment. There's no need to test them: with randomization, any baseline difference is chance by definition.
What to Do
- Design Change Measure the covariate before the treatment starts, and randomize people to groups.
- Proceed with Caveat With pre-existing groups that differ on the covariate, report both the unadjusted and adjusted means and say that neither is a causal comparison.
3. Linearity (for What the Adjustment Means) Within each group, the expected outcome rises or falls in a straight line with the covariate. Check a plot of the residuals against the covariate, and add a curved term if the relationship bends.
- What It Means
- As one variable goes up, the other tends to change by about the same amount across its whole range. A curved relationship, one that levels off or a U shape, breaks this.
- Applies To
- Relationship
- How to Check
- Look at a scatterplot of each pair of variables the analysis relates: a roughly oval cloud tilted one way is fine; a clear bend, a ceiling or a U is not. In a regression with several predictors, plot the residuals against the predicted values instead: a flat, even band is fine; a curve means the model is missing a bend. A component-plus-residual plot for each predictor (R: car::crPlots) shows whether one of them bends once the others are held constant.
- How Much It Matters
- A lot. The adjustment slides each group along a straight line, so a curved relationship adjusts by the wrong amount and leaves noise behind. In our data a squared pretest term adds nothing (p = .68).
What to Do
- Correction Add a squared covariate term to the model, which lets the adjustment bend.
- Transformation Log-transform a covariate whose relationship with the outcome levels off. The adjusted means are still on the outcome's scale.
4. Equal Slopes (for a Single Adjusted Difference) Standard ANCOVA uses one slope for every group. Look at the groups' slopes and plots, and model a group × covariate interaction when different slopes are plausible; a non-significant interaction test doesn't show the slopes are equal.
- What It Means
- The line linking the covariate to the outcome has about the same slope in each group, so the groups' lines are parallel. The adjustment uses one shared slope, and a single adjusted difference between groups only makes sense if the gap between the lines is the same all along the covariate.
- Applies To
- Covariate
- How to Check
- Plot the outcome against the covariate with a separate line for each group and look for lines that cross or fan out, and compare the groups' own slopes. Fitting the model once with a group × covariate interaction is a supporting check, not a gate: in a small study a non-significant interaction isn't evidence that the slopes are equal, and in a large one a significant interaction can flag a trivial difference. Whether to keep one shared slope is a judgment from theory, the plots and your prespecified plan, not from the interaction test alone.
- How Much It Matters
- A lot, for what the adjusted means mean. With different slopes, the gap between groups depends on where on the pretest you look, so a single adjusted difference is misleading. Here the slopes are 0.70, 0.66 and 0.74, and the group × pretest interaction is tiny, F(2, 78) = 0.07, p = .94. The slopes and the plot are the evidence; a non-significant interaction in a study this size wouldn't show the slopes are equal on its own.
What to Do
- Alternative Test Multiple Linear Regression. Keep the group × covariate interaction in a regression and report the group difference at a few meaningful covariate values.
- Proceed with Caveat If the slopes differ only a little and groups have similar covariate means, report the ANCOVA with the interaction test beside it.
5. Normality of the Residuals (for the p-Values and Intervals) Each student's distance from their group's fitted line is roughly normal; the raw pretest and posttest scores needn't be. Moderate departures are often tolerated, especially with bigger groups, but strong skew, heavy tails or outliers can still matter.
- What It Means
- The test's model assumes the scores it relies on are roughly normal: the scores within each group (or the scores themselves, for a one-sample test), the difference scores in a paired design, or the residuals (the errors left around a model's predictions) in a regression. For p-values and confidence intervals, what really matters is that the estimates (such as a mean, a difference between means or a model's coefficients) are roughly normal across repeated samples. A large enough sample usually provides that; how large depends on how skewed the scores are and how extreme their outliers.
- Applies To
- Residuals
- How to Check
- Fit the model and plot the residuals (each student's posttest minus their group's line at their pretest) in a histogram or Q–Q plot. Look for strong skew or extreme residuals. Don't rely on a normality test: with small samples it misses real problems, and with large ones it flags trivial ones.
- How Much It Matters
- Little, with 28 per group, for the false-positive rate; extreme outliers matter more, because one person far from their group's line can pull both the slope and the adjusted means. Here the residuals' skewness runs from 0.20 to 0.39 across the groups, and no standardized residual is beyond 2.5 (Shapiro-Wilk on the residuals, p = .25, for the record).
What to Do
- Robust Estimation Fit the same model with a robust regression, which down-weights outliers.
- Transformation Log-transform right-skewed outcomes such as reaction times. Results are then on the log scale.
6. Equal Residual Variances (for the p-Values and Intervals) The scatter of scores around each group's fitted line is about the same in every group. Equal raw posttest SDs don't show this: what matters is the spread left after the adjustment.
- What It Means
- The outcome varies about as much within each group's population. Tests that pool the groups' variances into one estimate, like Student's t-test and the classic ANOVA, rely on it.
- Applies To
- Variances
- How to Check
- Compare the groups' standard deviations and look at side-by-side box plots. Don't use Levene's test as a gatekeeper: it misses real differences in small samples and flags trivial ones in large samples.
- How Much It Matters
- Less with equal group sizes, like our 28 per group, where the residual SDs run from 4.05 to 4.50. With unequal sizes and spreads, error rates drift away from α.
What to Do
-
Correction
Use heteroscedasticity-consistent (HC3) standard errors for the group comparisons, which most regression software offers. For our data (in R,
car::Anova(fit, type = 3, white.adjust = "hc3")) the session test gives F(2, 80) = 3.95, p = .023, close to the classic 3.89 and .025.
Limitations
This Is Not Your Test If…
- You have no covariate worth adjusting for One-Way Between-Subjects ANOVA →
- The covariate's slope differs across your groups Multiple Linear Regression →
- You measured several outcomes at once MANCOVA →
- You have two or more grouping variables and no covariate (with a covariate, the same model extends to a factorial ANCOVA) Factorial Between-Subjects ANOVA →
- You measured the same people in every condition One-Way Repeated-Measures ANOVA →
- Your outcome isn't continuous (yes/no, categories) Categorical Data and Proportions →
What It Doesn't Tell You
- Which sessions. The omnibus test only says the three adjusted averages aren't all equal. The follow-up comparisons show that only expressive writing differed reliably from the control.
- Why. Random assignment lets us say the sessions made a difference, but not why writing helped: putting worries into words, the extra attention, or expecting it to work.
- Whether it matters. Significance doesn't make 3 points on a 9–45 scale a change students would notice when they sit down to a math exam.
- What non-randomized groups would have scored. Here the pretest only evened out chance differences. With pre-existing groups, such as students who chose a math major and those who didn't, adjusting for the pretest usually can't tell you what they'd look like if they had started the same (Miller & Chapman, 2001).
- That there's no difference, for reappraisal. It didn't differ reliably from either other session, but its intervals are about 5.6 points wide. That's inconclusive, not evidence it does nothing.
Common Mistakes
-
Don'tUse ANCOVA to “control for” a pre-existing difference between non-randomized groups.
InsteadPrefer random assignment when estimating treatment effects. With pre-existing groups, report both the adjusted and unadjusted comparisons and say what would have to be true for a causal reading: ANCOVA alone can't make the groups comparable.
-
Don'tUse a covariate measured after the treatment started.
InsteadMeasure covariates before assignment, so the treatment can't have changed them.
-
Don'tAdd covariates after seeing that the ANOVA wasn't significant.
InsteadChoose the covariate before collecting data, and preregister it.
-
Don'tReport the unadjusted group means as if they were the ANCOVA's result.
InsteadReport the adjusted means, which are what the F-test compares, next to the raw ones.
-
Don'tSkip the check for equal slopes.
InsteadCompare the groups' slopes and plot them, with the group × covariate interaction as a supporting check. Decide whether to keep a shared slope from theory, the plots and your prespecified plan, not from the interaction test's p alone: a non-significant test doesn't show the slopes are equal.
-
Don'tAdd up the partial η² values as if they split the variation between them.
InsteadRemember each has its own denominator, so they can sum past 1. Report η² if you want shares of the total.
-
Don'tReport partial η² under the label η².
InsteadSay which one you report. SPSS prints partial η², which is never smaller than η² and is usually larger, especially with other effects or repeated measures.
-
Don'tRead a p-value as the chance that the null hypothesis is true.
InsteadRead it as: if the null were true, how often data at least this extreme would turn up.
Result Decoder
Significance and Effect Size Guidelines
Benchmarks Significance (p Value)
-
p < .001
Very strong evidence against the null hypothesis.
-
.001 ≤ p < .01
Strong evidence against the null hypothesis.
-
.01 ≤ p < .05
Statistically significant at α = .05. Moderate evidence against the null hypothesis.
-
.05 ≤ p < .10
Not significant. Weak evidence; sometimes called a “trend.” Treat it as inconclusive.
-
p ≥ .10
Not significant. Little evidence against the null, which is not the same as evidence of no effect.
These evidence labels are one common convention for describing p in graded language rather than as significant or not; the boundaries are rough guides, not rules, and other authors draw them differently. Muff et al. (2022) argue for this kind of language of evidence over a single cutoff. α is chosen before the analysis, and p never says how big or important an effect is.
Benchmarks Effect Size (Generalized Eta Squared)
-
η²G < .01
Below Small
Smaller than the conventional small benchmark. Whether an effect this size matters depends on the setting.
-
.01 ≤ η²G < .06
Small
A small effect next to the background variation: differences between people, measured factors and error. Hard to see without measuring it.
-
.06 ≤ η²G < .14
Medium
A noticeable effect next to the background variation.
-
η²G ≥ .14
Large
A large effect next to the background variation.
Cohen's (1988) η² benchmarks, which generalized η² can be held against because it keeps the covariate's variation in the denominator, as a plain η² would. By them our .05 is small. Lakens (2013) calls this a last resort: comparing with similar effects in the literature is better. Don't hold partial η² against them in a design with a covariate.
How It's Reported
Equation Form
F(2, 80) = 3.89, p = .025, η2G = .05 (partial η2p = .09, 95% CI [.00, .21])
Table 1. Pretest and Posttest Math Anxiety by Session
| n | Pretest M | Pretest SD | Posttest M | Posttest SD | Adjusted M | SE | 95% CI | |
|---|---|---|---|---|---|---|---|---|
| Control | 28 | 26.50 | 6.02 | 26.00 | 6.00 | 26.35 | 0.81 | [24.73, 27.97] |
| Reappraisal | 28 | 27.00 | 6.01 | 24.50 | 6.01 | 24.50 | 0.81 | [22.88, 26.12] |
| Expressive writing | 28 | 27.50 | 6.00 | 23.50 | 5.98 | 23.15 | 0.81 | [21.53, 24.77] |
Note. Scores on the AMAS (9–45). Adjusted means are posttest means evaluated at the overall pretest mean, 27.00; their standard errors and 95% CIs come from the ANCOVA.
Table 2. ANCOVA for Posttest Math Anxiety
| SS | df | MS | F | p | \eta^2_G | \eta^2_p | |
|---|---|---|---|---|---|---|---|
| Pretest anxiety (covariate) | 1433.04 | 1 | 1433.04 | 77.41 | < .001 | .49 | |
| Session | 143.85 | 2 | 71.92 | 3.89 | .025 | .05 | .09 |
| Error | 1480.96 | 80 | 18.51 |
Note. η²G = generalized eta squared, whose denominator keeps the covariate's variation; η²p = partial eta squared, which leaves it out. Type III sums of squares. The session row is the test; the pretest row shows how strongly the covariate predicts the outcome.
Full Text (APA Style)
Adjusting for pretest math anxiety, students who did expressive writing reported the least anxiety two weeks later (adjusted M = 23.15), followed by reappraisal (adjusted M = 24.50) and the control session (adjusted M = 26.35); the unadjusted posttest means were 23.50 (SD = 5.98), 24.50 (SD = 6.01) and 26.00 (SD = 6.00). An ANCOVA with pretest anxiety as the covariate showed the adjusted differences were statistically significant, F(2, 80) = 3.89, p = .025. The pretest-adjusted session effect was small, η2G = .05 (partial η2p = .09, 95% CI [.00, .21]: session's share of the variation the pretest leaves unexplained, with its interval from the noncentral F distribution). Pretest anxiety strongly predicted posttest anxiety, F(1, 80) = 77.41, p < .001. Bonferroni-corrected comparisons of the adjusted means showed that expressive writing lowered anxiety by 3.20 points relative to the control session, 95% CI [0.38, 6.02], p = .021; the other two differences were not significant (both p > .33). The sessions' pretest–posttest slopes were similar (0.70, 0.66 and 0.74; group × pretest interaction F(2, 78) = 0.07, p = .94).
- Name the covariate and when it was measured, so readers can judge the adjustment.
- Give the adjusted means, which are what the test compares, alongside the raw means and SDs.
- Report both degrees of freedom; the error df is N − k − c, one for each of the c covariates (here 84 − 3 − 1 = 80).
- Say that you checked for equal slopes, and how.
- Lead with generalized η² (η²G), which keeps the covariate's variation in the denominator and compares with studies that had no covariate. If you also give partial η², as SPSS prints it, label it: with a covariate the two differ.
- Give an effect size a confidence interval when there's a sound method for it, and say how it was computed. Partial η² has one: invert the noncentral F distribution (two-sided 95%, as R's effectsize package gives it). Generalized η² with a measured covariate doesn't have a standard one; effectsize prints an interval for it by treating it as if it were a partial η² with the same df, which ignores the covariate's own sampling variation, so give its point estimate alone. An interval running from .00 to .21 is a reminder of how loosely 84 students pin the size down.
Reading Each Piece
The equation form above, piece by piece, in this order: how big, then how surprising.
| η2G = .05 | Set against all the variation in later anxiety, including where students started, the session effect comes to about .05. That's small by the benchmarks above; partial η² (.09) is larger only because it sets the pretest's share aside. Whether 3 points on a 9–45 scale matters is a question about students, not statistics. Benchmarks ↑ |
| F(2, 80) = 3.89 | The adjusted session averages vary 3.89 times as much as the leftover noise would produce on its own. The 2 and 80 are the degrees of freedom: k − 1 and N − k − 1. |
| p = .025 | If the three sessions' population means were equal after accounting for pretest anxiety, an F of 3.89 or more would turn up about 2.5% of the time, under the test's assumptions. That's below .05, so the result is statistically significant. Benchmarks ↑ |
Calculations
The Running Example
The math-anxiety study: 84 undergraduates, 28 per session (control, reappraisal, expressive writing), each with a math anxiety score before the session (the covariate) and two weeks after (the outcome).
- Null Hypothesis:
- \mu_{\text{control}}' = \mu_{\text{reappraisal}}' = \mu_{\text{writing}}'
- Alternative:
- \text{not all three adjusted } \mu \text{ are equal}
Each \mu' (“mu prime”) is the population's posttest mean for one session, adjusted to the same pretest level. Our adjusted means of 26.35, 24.50 and 23.15 estimate them. The alternative doesn't say which sessions differ or in what direction.
What Your Data Should Look Like
One row per person, with one column naming their group, one numeric column for the covariate and one for the outcome. Each person appears once, in exactly one group, and has both scores.
| participant | group | pre_anxiety | post_anxiety |
|---|---|---|---|
| 1 | writing | 27 | 23 |
| 2 | reappraisal | 30 | 25 |
| 3 | reappraisal | 30 | 30 |
| 4 | writing | 25 | 20 |
| 5 | control | 23 | 24 |
| 6 | control | 36 | 28 |
| … 78 more rows | |||
| n | Pre Anxiety M (SD) | Post Anxiety M (SD) | Post Anxiety Adj. M | |
|---|---|---|---|---|
| Control | 28 | 26.50 (6.02) | 26.00 (6.00) | 26.35 |
| Reappraisal | 28 | 27.00 (6.01) | 24.50 (6.01) | 24.50 |
| Expressive writing | 28 | 27.50 (6.00) | 23.50 (5.98) | 23.15 |
| All | 84 | 27.00 (5.95) | 24.67 (6.01) |
Adjusted means are each group's mean at the overall pre anxiety mean, 27.00, using the pooled within-group slope (b = 0.70).
Simulated data.
Napkin Math
The whole test, one idea at a time. Under each heading, a line says why the step matters, and the green note reads the equation in plain English with the math-anxiety study's numbers. Collapse all to read just the headings: they tell the whole story on their own.
-
1. Find Each Group's Average Anxiety Before and After
ANCOVA works with two averages per group, one for the covariate and one for the outcome. With random assignment, the before averages should be close but not identical.
\bar{x}_j \;(\text{before}), \quad \bar{y}_j \;(\text{after})\bar{x}_{\text{control}} = 26.50 points
\bar{x}_{\text{reappraisal}} = 27.00 points
\bar{x}_{\text{writing}} = 27.50 points
\bar{y}_{\text{control}} = 26.00 points
\bar{y}_{\text{reappraisal}} = 24.50 points
\bar{y}_{\text{writing}} = 23.50 points
\bar{x}_j is a session's average pretest score and \bar{y}_j its average two weeks later. Before, the groups sat at 26.50, 27.00 and 27.50 around an overall 27.00; after, at 26.00 (control), 24.50 (reappraisal) and 23.50 (writing).
-
2. Find How Much Pretest Anxiety Predicts Later Anxiety within a Group
Students who start more anxious tend to stay more anxious. The slope says by how much, and measuring it within each group keeps any real session effect out of it.
b_w = \dfrac{\sum (x_{ij} - \bar{x}_j)(y_{ij} - \bar{y}_j)}{\sum (x_{ij} - \bar{x}_j)^2} =\dfrac{2047}{2924}b_w = 0.70
The top adds up, for every student, their distance from their group's pretest average times their distance from its posttest average. This is the sum of products, SP_{xy(w)} = 2047. The bottom is the same with the pretest distances squared, 2924. 2047 ÷ 2924 = 0.70, so each extra pretest point goes with 0.70 more points two weeks later.
-
3. Adjust Each Group's Average to a Common Starting Point
A group that started a little more anxious would end a little more anxious even if its session did nothing. Sliding each group's average along the slope to the overall starting point removes that head start.
\bar{y}_j' = \bar{y}_j - b_w(\bar{x}_j - \bar{x}) =23.50 - 0.70\,(27.50 - 27.00)\bar{y}_{\text{control}}' = 26.35 points
\bar{y}_{\text{reappraisal}}' = 24.50 points
\bar{y}_{\text{writing}}' = 23.15 points
The writing group started 0.50 above the overall 27.00, so it loses 0.70 × 0.50 = 0.35 and ends at 23.15. Control started 0.50 below and gains 0.35, to 26.35. Reappraisal started right at 27.00 and stays at 24.50. The gap between control and writing grows from 2.50 to 3.20 points.
-
4. Measure How Much Noise Is Left Once the Pretest Is Accounted For
Much of what looks like random variation between students in the same session is really just where they started. Taking out the part the pretest predicts leaves a much smaller amount of noise.
SS_{\text{error}} = SS_{y(w)} - \dfrac{SP_{xy(w)}^2}{SS_{x(w)}} =2914 - \dfrac{2047^2}{2924}SS_{\text{error}} = 1480.96
SS_{y(w)} = 2914
SS_{y(w)} is the 2914 of within-session variation an ANOVA would call noise. The pretest predicts 2047² ÷ 2924 = 1433.04 of it, leaving 1480.96. About half the noise was just starting points.
-
5. Measure How Much the Sessions Add beyond the Pretest
Predict everyone's later anxiety from the pretest alone, then from the pretest plus which session they had. However much the leftover variation shrinks is what the sessions add.
SS_{\text{group(adj)}} = SSE_{\text{covariate only}} - SSE_{\text{covariate + groups}} =1624.81 - 1480.96SSE_{\text{covariate only}} = 1624.81
SS_{\text{group(adj)}} = 143.85
With only the pretest, one line is fitted to all 84 students at once, ignoring session. Measured from the overall averages, the posttest sum of squares is 3002.67, the pretest's is 2938 and their sum of products is 2012, so the line's slope is 2012 ÷ 2938 = 0.68 (not b_w), and it leaves 3002.67 − 2012² ÷ 2938 = 1624.81 unexplained. Knowing the session as well brings that down to step 4's SS_{\text{error}} of 1480.96 (the SSE_{\text{covariate + groups}} above), so the sessions add 1624.81 − 1480.96 = 143.85.
-
6. Compare the Adjusted Group Differences with the Leftover Noise
As in an ANOVA, turn both sums into averages and divide. The noise loses one extra piece of information, because the slope was estimated from the same data.
F = \dfrac{SS_{\text{group(adj)}} / (k - 1)}{SS_{\text{error}} / (N - k - 1)} =\dfrac{143.85 / 2}{1480.96 / 80} = \dfrac{71.92}{18.51}= 3.89
F_{\text{ANOVA}} = 1.23
k - 1 = 2 for three sessions, and N - k - 1 = 84 - 3 - 1 = 80. 71.92 ÷ 18.51 = 3.89. The same data without the pretest give an ANOVA F of only 1.23. Its noise term, 35.98, is nearly twice as big, and its group differences are a little smaller before the adjustment (mean square 44.33 rather than 71.92).
-
7. Size the Session Effect against All the Variation
F grows with sample size; generalized η² doesn't. The pretest was measured, not manipulated, so its variation stays in the denominator, just as it would if we'd never recorded it. That keeps the size comparable with studies that had no covariate.
\eta^2_G = \dfrac{SS_{\text{group(adj)}}}{SS_{\text{group(adj)}} + SS_{\text{covariate}} + SS_{\text{error}}} =\dfrac{143.85}{143.85 + 1433.04 + 1480.96}= .05
\eta^2_p = .09
95\%\ \text{CI}_{\eta^2_p} = [.00, .21]
SS_{\text{group(adj)}} is our 143.85, SS_{\text{covariate}} the 1433.04 the pretest predicts and SS_{\text{error}} the 1480.96 left over. 143.85 ÷ 3057.85 = .05. Partial η² drops the pretest's 1433.04 from the bottom, 143.85 ÷ 1624.81 = .09.
-
8. Ask How Surprising the Result Would Be If the Sessions Worked Equally Well
Finally, ask how often an ANCOVA F at least this large would turn up if all three sessions had the same population mean after accounting for the pretest.
p = P(F_{df_1,\,df_2} \ge F) =P(F_{2,\,80} \ge 3.89)= .025
p_{\text{ANOVA}} = .297
F_{2,\,80} is an F distribution with 2 and 80 df. The chance it lands at or above 3.89 is .025, about 1 in 41. The ANOVA without the pretest gives .297.
-
9. Check That the Pretest Predicts Later Anxiety Equally Well in Every Group
The adjustment used one shared slope. That's only fair if each session's own slope is about the same; otherwise the gap between groups depends on where students started.
F = \dfrac{(SS_{\text{error}} - SS_{\text{separate}}) / (k - 1)}{SS_{\text{separate}} / (N - 2k)} =\dfrac{(1480.96 - 1478.48) / 2}{1478.48 / 78}F_{\text{slopes}} = 0.07
p_{\text{slopes}} = .94
Giving each session its own slope (0.70, 0.66 and 0.74) only lowers the leftover variation from 1480.96 to 1478.48. With N - 2k = 78, that's 1.24 ÷ 18.95 = 0.07, p = .94. The estimated slopes are similar, and the interaction test finds little evidence that they differ. That supports one shared slope for this example, though a non-significant test doesn't show the population slopes are identical.
Run It in Software
The code below reads the running example's data from data.csv; save it in the same folder you run the code from.
SPSS (version 30, as documented by IBM)
- First check the slopes: Analyze → General Linear Model → Univariate. Move
post_anxietyinto Dependent Variable,groupinto Fixed Factor(s) andpre_anxietyinto Covariate(s). - Model: choose Build terms, add
group,pre_anxietyand thegroup*pre_anxietyinteraction, and run it. Look only at the interaction row. - Open Univariate again and set Model back to Full factorial (main effects of
groupandpre_anxiety, no interaction). - EM Means: move
groupinto Display Means for, check Compare main effects, and choose Bonferroni. - Options: check Descriptive statistics and Estimates of effect size, and click OK.
Or paste this syntax:
* Step 1: equal slopes (read only the group * pre_anxiety row). UNIANOVA post_anxiety BY group WITH pre_anxiety /METHOD=SSTYPE(3) /DESIGN=group pre_anxiety group*pre_anxiety. * Step 2: the ANCOVA. UNIANOVA post_anxiety BY group WITH pre_anxiety /METHOD=SSTYPE(3) /EMMEANS=TABLES(group) WITH(pre_anxiety=MEAN) COMPARE ADJ(BONFERRONI) /PRINT=DESCRIPTIVE ETASQ /CRITERIA=ALPHA(.05) /DESIGN=pre_anxiety group.
Reading the Output
Read the tables in this order: the Estimated Marginal Means (the adjusted means), then Partial Eta Squared and F and Sig. in the group row of Tests of Between-Subjects Effects, then Pairwise Comparisons to see which sessions differ.
Tests of Between-Subjects Effects (Dependent Variable: post_anxiety)
| Source | Type III Sum of Squares | df | Mean Square | F | Sig. | Partial Eta Squared |
|---|---|---|---|---|---|---|
| Corrected Model | 1521.707 | 3 | 507.236 | 27.400 | <.001 | .507 |
| Intercept | 127.222 | 1 | 127.222 | 6.872 | .010 | .079 |
| pre_anxiety | 1433.040 | 1 | 1433.040 | 77.411 | <.001 | .492 |
| group | 143.850 | 2 | 71.925 | 3.885 | .025 | .089 |
| Error | 1480.960 | 80 | 18.512 | |||
| Total | 54112.000 | 84 | ||||
| Corrected Total | 3002.667 | 83 |
SPSS prints only partial eta squared (.089 for group). For generalized η², add the pre_anxiety sum of squares back into the denominator: 143.850 ÷ (143.850 + 1433.040 + 1480.960) = .047.
The group row is the test. The pre_anxiety row shows the covariate strongly predicts the outcome; it isn't the question. Ignore Intercept and Corrected Model.
Estimates (covariates evaluated at pre_anxiety = 27.00)
| group | Mean | Std. Error | 95% CI Lower | Upper |
|---|---|---|---|---|
| control | 26.350 | .814 | 24.730 | 27.970 |
| reappraisal | 24.500 | .813 | 22.882 | 26.118 |
| writing | 23.150 | .814 | 21.530 | 24.770 |
Pairwise Comparisons (Bonferroni)
| (I) group | (J) group | Mean Difference (I−J) | Std. Error | Sig. | 95% CI Lower | Upper |
|---|---|---|---|---|---|---|
| control | reappraisal | 1.850 | 1.151 | .335 | -.964 | 4.664 |
| control | writing | 3.200* | 1.153 | .021 | .381 | 6.019 |
| reappraisal | writing | 1.350 | 1.151 | .732 | -1.464 | 4.164 |
SPSS lists every pair twice, once in each direction; three rows are shown here. In the step 1 run, the group * pre_anxiety row reads F = 0.065, Sig. = .937. The estimated slopes are similar, and this test provides little evidence of slope differences. The common-slope model is used for the worked example; model selection should also consider theory, graphical diagnostics and the prespecified plan.
Output laid out from this page's computed results, not captured from a live run; labels and layout may differ slightly in your version.
R
study <- read.csv("data.csv")
study$group <- factor(study$group, levels = c("control", "reappraisal", "writing"))
options(contrasts = c("contr.sum", "contr.poly")) # so Type III tests are meaningful
library(car)
library(emmeans)
library(effectsize)
# Equal slopes: look at the group:pre_anxiety row
Anova(lm(post_anxiety ~ group * pre_anxiety, data = study), type = 3)
fit <- lm(post_anxiety ~ group + pre_anxiety, data = study)
Anova(fit, type = 3)
# Generalized eta squared: the pretest was measured, not manipulated
eta_squared(Anova(fit, type = 3), generalized = "pre_anxiety",
alternative = "two.sided")
# Partial eta squared, with its noncentral-F interval
eta_squared(Anova(fit, type = 3), alternative = "two.sided")
# Adjusted means and Bonferroni comparisons
emm <- emmeans(fit, ~ group)
emm
pairs(emm, adjust = "bonferroni")
Anova Table (Type III tests)
Response: post_anxiety
Sum Sq Df F value Pr(>F)
(Intercept) 126.86 1 6.6929 0.01154 *
group 12.05 2 0.3178 0.72867
pre_anxiety 1433.27 1 75.6152 4.205e-13 ***
group:pre_anxiety 2.48 2 0.0655 0.93667
Residuals 1478.48 78
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Anova Table (Type III tests)
Response: post_anxiety
Sum Sq Df F value Pr(>F)
(Intercept) 127.22 1 6.8724 0.01047 *
group 143.85 2 3.8853 0.02453 *
pre_anxiety 1433.04 1 77.4114 2.188e-13 ***
Residuals 1480.96 80
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Effect Size for ANOVA (Type III)
Parameter | Eta2 (generalized) | 95% CI
-----------------------------------------------
group | 0.05 | [0.00, 0.15]
pre_anxiety | 0.49 | [0.34, 0.61]
- Observed variables: pre_anxiety
# Effect Size for ANOVA (Type III)
Parameter | Eta2 (partial) | 95% CI
-------------------------------------------
group | 0.09 | [0.00, 0.21]
pre_anxiety | 0.49 | [0.34, 0.61]
group emmean SE df lower.CL upper.CL
control 26.4 0.814 80 24.7 28.0
reappraisal 24.5 0.813 80 22.9 26.1
writing 23.1 0.814 80 21.5 24.8
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
control - reappraisal 1.85 1.15 80 1.608 0.3354
control - writing 3.20 1.15 80 2.776 0.0205
reappraisal - writing 1.35 1.15 80 1.173 0.7324
P value adjustment: bonferroni method for 3 tests
Read the group row of the second table for the test, then the group row of the first effect size table for generalized η², and of the second for partial η² and its 95% CI. Report generalized η² without the interval effectsize prints beside it: that interval treats η²G as if it were a partial η² with the same df, an approximation that ignores the pretest's own sampling variation. generalized = "pre_anxiety" tells effectsize the pretest was measured rather than manipulated, so its variation stays in the denominator; alternative = "two.sided" gives the two-sided interval (by default effectsize fixes the upper bound at 1). Anova from the car package gives Type III tests; base R's anova() gives sequential ones, which depend on the order of the terms. emmeans rounds the adjusted means for display (26.35, 24.50 and 23.15 to two decimals).
Output from a real run: R 4.6.1 (car 3.1.5, emmeans 2.0.4, effectsize 1.0.3), run 2026-10-03.
Python
import pandas as pd
import pingouin as pg
study = pd.read_csv("data.csv")
# Adjusted group test, with partial eta squared (np2)
pg.ancova(data=study, dv="post_anxiety", covar="pre_anxiety", between="group")
Source SS DF F p-unc np2
0 group 143.849635 2 3.885308 2.452639e-02 0.088533
1 pre_anxiety 1433.040014 1 77.411410 2.187709e-13 0.491778
2 Residual 1480.959986 80 NaN NaN NaN
Read the group row: F(2, 80) = 3.89, p = .025, partial η² = .089. Pingouin doesn't print generalized η²; compute it from the SS column as 143.85 ÷ (143.85 + 1433.04 + 1480.96) = .047. For the slopes check, fit the model with statsmodels (import statsmodels.formula.api as smf and from statsmodels.stats.anova import anova_lm): anova_lm(smf.ols("post_anxiety ~ C(group, Sum) * pre_anxiety", study).fit(), typ=3) gives the interaction row (F = 0.065, p = .937).
Output from a real run: Python 3.9.6 (pingouin 0.5.5, pandas 2.3.3), run 2026-09-29.
Impact
Effect Size
Generalized eta squared (η²G) sets the group effect against the outcome's variation, counted the way it would be in a study without the covariate. The sessions were manipulated; the pretest was only measured. So the variation the pretest predicts stays in the denominator, and the effect can be compared with ANOVAs and ANCOVAs that used other covariates or none (Olejnik & Algina, 2003).
Set against the variation in students' later math anxiety, with the part that goes back to where they started kept in, the session effect (adjusted for the pretest) comes to about 5%, a small effect by convention. It's a ratio rather than a slice of one pie: the session SS and the pretest SS are each adjusted for the other, so the three pieces add to slightly more than the total SS of 3,002.67.
Partial eta squared (η²p) is what SPSS prints and what power analyses use. It drops the covariate's share from the denominator, 143.85 ÷ (143.85 + 1480.96) = .09, so it runs larger, and the stronger the covariate, the larger it gets for the same group difference. That makes it useful for planning a study with the same covariate, and misleading as a size to compare across designs or to hold against Cohen's benchmarks. If you report both, label them.
Benchmarks are conventions, and Lakens (2013) calls holding η²G against them a last resort; comparing with similar interventions is better. For the comparison readers care about, give the size in points: expressive writing ended 3.20 points below the control session on a 9–45 scale, after adjusting for where students started, 95% CI [0.38, 6.02]. That's about half of a standard deviation of raw posttest scores (6.00). The two sizes don't disagree: η²G averages over all three sessions, including reappraisal sitting in the middle, while the gap between writing and control is the single largest one. Whether 3 points of math anxiety is worth a 20-minute session is a question about students, not statistics.
Benchmarks Generalized Eta Squared at a Glance
Statistical Significance
p answers one narrow question: if every group's adjusted population mean were the same, how often would the adjusted sample means spread at least this far apart? Only a large F counts against the null, so p comes from one tail of the F distribution, but it responds to differences in any direction. Below the conventional α = .05, the result is called statistically significant.
If the three sessions' population means were equal after accounting for pretest anxiety, an ANCOVA F of 3.89 or more would turn up about 2.5% of the time, roughly 1 in 41, under the test's assumptions. F measures how far apart the adjusted means (26.35, 24.50 and 23.15) are relative to the scatter left around the groups' lines. That's below .05, so it's significant. An ANOVA on the same posttest scores, ignoring the pretest, gives p = .297. Two things changed. The noise shrank by about half, and the adjustment widened the gaps a little, because the writing group happened to start 0.50 points higher. The adjustment can move group differences in either direction, not only remove noise.
p is not the probability that the null hypothesis is true, and it says nothing about how large the differences are or which sessions differ. That's what generalized η², the adjusted means and the follow-up comparisons are for. And the gap between .025 and .297 is only legitimate because the pretest was chosen before the data came in; picking a covariate because it rescues a result turns p into a search.
Benchmarks p at a Glance
Strength of evidence against the null hypothesis.
Power and Sample Size
Power is the chance that a study detects an effect that's really there. A real effect doesn't guarantee a significant result: with too few people, it can easily come out non-significant. Power depends on how big the true effect is, how many people are in each group, how many groups there are, α, and, for ANCOVA, how strongly the covariate predicts the outcome.
That last one is the reason to use ANCOVA. A covariate that correlates ρ with the outcome within groups shrinks the noise to about 1 − ρ² of what it was, so an ANCOVA needs only about (1 − ρ²) times as many people as an ANOVA for the same power (Borm et al., 2007). A pretest that correlates .70 with the posttest cuts the sample you need roughly in half; one that correlates .30 saves only 9%.
Suppose, before collecting any data, we expected a medium effect of the sessions, f = 0.25, and a pretest–posttest correlation of about .70 (1 − .70² = .51). An ANOVA would need 53 students per session for 80% power. With the pretest as a covariate, 28 per session, the size of our study, gives about 81%. Without the covariate, those same 28 per session would give only 51%.
There's no ANCOVA calculator on this page. To use an ANOVA calculator, like the one on the One-Way Between-Subjects ANOVA page, plan the ANOVA sample size and multiply it by 1 − ρ², using a correlation from earlier studies with the same measure, not from your own data, and add a person or two per group. That's a planning approximation: with several groups, the df the covariate uses, uncertainty in the correlation and different effect-size definitions can all change the answer, so for a real study check it with a calculation or simulation for your design.
Researchers usually aim for at least 80% power. Plan it before collecting data, using the smallest effect that would matter and a conservative guess at the correlation.
Other Info
Follow-Up and Post Hoc Tests
Planned Contrasts
- Planned Contrasts: Use when theory predicted a comparison before you collected data, like both active sessions versus the control. Test it on the adjusted means with the ANCOVA's error term. In the math-anxiety study that contrast gives t(80) = 2.53, p = .013.
Post Hoc Tests
- Bonferroni Correction: The usual choice for comparing every pair of adjusted means, and what SPSS offers for them. For our data, only writing versus control differs: 3.20 points lower, 95% CI [0.38, 6.02], p = .021; reappraisal versus control, p = .335; writing versus reappraisal, p = .732.
- Holm Correction: Gives the same protection as Bonferroni with more power. For our data it agrees: writing versus control, Holm-adjusted p = .021; the other two, p = .224 and .244.
References
- Cochran, W. G. (1957). Analysis of covariance: Its nature and uses. Biometrics, 13(3), 261–281. https://doi.org/10.2307/2527916
-
Miller, G. A., & Chapman, J. P. (2001). Misunderstanding analysis of covariance. Journal of Abnormal Psychology, 110(1), 40–48.
https://doi.org/10.1037/0021-843X.110.1.40
“In many cases, there is no means of achieving the superficially appealing goal of 'correcting' or 'controlling for' real group differences on a potential covariate” (Abstract)
-
Van Breukelen, G. J. P. (2006). ANCOVA versus change from baseline: More power in randomized studies, more bias in nonrandomized studies. Journal of Clinical Epidemiology, 59(9), 920–925.
https://doi.org/10.1016/j.jclinepi.2006.02.007
“In randomized studies both methods are unbiased, but ANCOVA has more power.” (Abstract)
-
Borm, G. F., Fransen, J., & Lemmens, W. A. J. G. (2007). A simple sample size formula for analysis of covariance in randomized clinical trials. Journal of Clinical Epidemiology, 60(12), 1234–1238.
https://doi.org/10.1016/j.jclinepi.2007.02.006
“If the correlation between the outcome measured at baseline and at follow-up is rho, ANCOVA comparing groups of (1-rho(2))n subjects has the same power as t-test comparing groups of n subjects.” (Abstract)
- Hopko, D. R., Mahadevan, R., Bare, R. L., & Hunt, M. K. (2003). The Abbreviated Math Anxiety Scale (AMAS): Construction, validity, and reliability. Assessment, 10(2), 178–182. https://doi.org/10.1177/1073191103010002008
-
Olejnik, S., & Algina, J. (2003). Generalized eta and omega squared statistics: Measures of effect size for some common research designs. Psychological Methods, 8(4), 434–447.
https://doi.org/10.1037/1082-989X.8.4.434
“Because research-design features can have a large effect on the estimated proportion of explained variance, the use of partial eta or omega squared can be misleading.” (Abstract)
“generalized eta and omega squared statistics, which provide estimates of effect size that are comparable across a variety of research designs” (Abstract)
-
Trigo Sánchez, M. E., & Martínez Cervantes, R. J. (2016). Generalized eta squared for multiple comparisons on between-groups designs. Psicothema, 28(3), 340–345.
https://doi.org/10.7334/psicothema2015.124
“SSSubjects/Cov includes the sums of squares involving subjects or covariates, equal to SSError in a between-group design” (p. 341)
-
Lakens, D. (2013). Calculating and reporting effect sizes to facilitate cumulative science: A practical primer for t-tests and ANOVAs. Frontiers in Psychology, 4, 863.
https://doi.org/10.3389/fpsyg.2013.00863
“Although η2G can be compared against the benchmarks provided by Cohen (1988), this should only be done as a last resort” (Eta-squared in between and within-subjects comparisons)
“using these benchmarks when interpreting the η2p effect size in designs that include covariates or repeated measures is not consistent with the considerations upon which the benchmarks were based” (Eta-squared in between and within-subjects comparisons)
- Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
- Maxwell, S. E., Delaney, H. D., & Kelley, K. (2018). Designing experiments and analyzing data: A model comparison perspective (3rd ed.). Routledge. https://doi.org/10.4324/9781315642956
- Bakeman, R. (2005). Recommended effect size statistics for repeated measures designs. Behavior Research Methods, 37(3), 379–384. https://doi.org/10.3758/BF03192707
- Cohen, J. (1973). Eta-squared and partial eta-squared in fixed factor ANOVA designs. Educational and Psychological Measurement, 33(1), 107–112. https://doi.org/10.1177/001316447303300111
- Pierce, C. A., Block, R. A., & Aguinis, H. (2004). Cautionary note on reporting eta-squared values from multifactor ANOVA designs. Educational and Psychological Measurement, 64(6), 916–924. https://doi.org/10.1177/0013164404264848
-
Muff, S., Nilsen, E. B., O'Hara, R. B., & Nater, C. R. (2022). Rewriting results sections in the language of evidence. Trends in Ecology & Evolution, 37(3), 203–210.
https://doi.org/10.1016/j.tree.2021.10.009
“we suggest language of evidence that allows for a more nuanced approach to communicate scientific findings as a simple and intuitive alternative to statistical significance testing” (Abstract)
Spot an error? Something still confusing? Tell us at support@statsforpsychology.com.