# Is one-way repeated measures ANOVA equivalent to a two-way ANOVA?

In a balanced repeated measures one-way ANOVA, we compare the true averages of a response variable across time points. Are the results about the time effects equivalent to those from a classic two-way ANOVA with "time" and "subject id" as factors? If yes, do you know a good reference about it?

Example in R (20 subject ids with one value for each of the three time points):

# Data generation
set.seed(2)
t0 <- rnorm(20)
t1 <- rexp(20) + t0 / 4
t2 <- runif(20) + t1 / 2
response <- c(t0, t1, t2)
time <- factor(rep(1:3, each = 20))
id <- factor(rep(1:20, times = 3))
#___________________________________________________________

# Two-way between-subject ANOVA
drop1(lm(response ~ time + id), test = "F")

# Output -> p-value of any time effect is 0.0013734

Df Sum of Sq    RSS      AIC F value    Pr(>F)
<none>              21.038 -18.8811
time    2     8.723 29.761  -2.0690  7.8780 0.0013734 **
id     19    39.129 60.167   6.1669  3.7199 0.0002787 ***
#___________________________________________________________

# Now the repeated-measures ANOVA
summary(aov(response ~ time + Error(id)))

# Output -> p-value also 0.00137
Error: id
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 19  39.13   2.059

Error: Within
Df Sum Sq Mean Sq F value  Pr(>F)
time       2  8.723   4.361   7.878 0.00137 **
Residuals 38 21.038   0.554


As far as I know, the methods provide also similar (wrong) p-values in the unbalanced case.

• A similar question stats.stackexchange.com/q/17378/3277. Commented Mar 6, 2015 at 18:27
• Thx, that is very helpful. Commented Mar 6, 2015 at 19:06
• (+1) Note that this equivalence only holds if you have exactly 1 data points per subject-time combination. If for each of the 20 subjects for each of the 3 time points you have $k>1$ measurements, then RM-ANOVA will not be equivalent to two-way ANOVA (the SS decomposition will be the same, but the F-values and p-values for the time effect will differ). Commented Jun 18, 2017 at 22:04
• Follow-up question based on my above comment: stats.stackexchange.com/questions/286280. Commented Jun 20, 2017 at 10:03