Get startedGet started for free

Repeated measures ANOVA

In the previous exercise, you saw how a paired t-test is more powerful than a regular t-test. During this exercise, you will see how statistical methods generalize. First, you will see how a paired t-test is a special case of a repeated measures ANOVA. In the process, you will see how a repeated measures ANOVA is a special case of a mixed-effects model by using lmer() in R.

The first part of this exercise will consist of transforming the simulated data from two vectors into a data.frame(). The second part will have you examine the model results to see how they are different. The third part will have you examine the outputs of the models and compare the results.

This exercise is part of the course

Hierarchical and Mixed Effects Models in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create the data.frame, using the variables from the previous exercise. 
# y is the joined vectors before and after.
# trial is the repeated names before and after, each one repeated n_ind
# ind is the letter of the individual, repeated 2 times (because there were two observations)
dat <- data.frame(y = c(___, ___), 
                  trial = rep(c("before", "after"), each = ___),
                  ind = rep(letters[1:n_ind], times = ___))
Edit and Run Code