Solved – Is one-way repeated measures ANOVA equivalent to a two-way ANOVA

anovarrepeated measures

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.

Best Answer

Well ... yes. Your scenario is actually very simple. It's basically a one-way randomized block design, where the blocks are individuals and Time is the treatment. The error for estimating the Time effect is the id x Time interaction with 38 degrees of freedom. You are treating id as a fixed (not random) effect, so you get the same answer either way, since you're doing the same thing.

The full beauty of repeated measures designs kicks in when you have within and between subject effects. Suppose 10 of the id's had treatment A and 10 had treatment B. Then the error for the A/B test is the id effect (with 19 DF's), and the error for the time effect is the "within subject error" with 38 DF's. The sums of squares for the effects themselves remain the same as they would be in a plain Jane two-way design; it's the denominator of the "F" tests that changes.

I observe that Douglas Montgomery's "design and analysis of experiments" is still in print and currently running its 8th edition. I recommend an old fashioned textbook for this kind of question, where the impact of various designs is explained in depth. Another interesting old-fashioned text is "The analysis of messy data" by Milliken and Johnson, which marches you through the difference between balanced and unbalanced designs, one expected mean square after another.