An introduction to repeated measures
1. An introduction to repeated measures
Often, we resample the same things over time. These study designs are called repeated measures and they are a special case of a mixed-effects model. During this section, I will show you how paired t-tests, repeated measures ANOVAs, and mixed-effect models are related. In the following sections of this chapter, we will see how to apply mixed-effects models to these situations.2. Repeated measures
To start off, what is a repeated measure? We might follow individuals through time, keep track of a football team over the course of a season, or visit the same forest sites repeatedly for an ecological study. These are repeated measures. These methods can be powerful because we can control for variability caused by individuals, teams, or sites.3. Paired t-test
A paired t-test is a special type of t-test that compares two observations to the same individual or samples. For example, we could look at student test scores pre- and post-intervention. The model is simple enough that it is a good introduction to repeated measures methods.4. Paired t-test in R
The script for running a paired t-test in R is straightforward. Simply run a t-test with the paired argument set to TRUE with input vectors x1 and x2. Note that the elements of x1 and x2 should be the same length and correspond to the same individual. Otherwise, the model is the same as a plain t-test in R. One benefit to a repeated measures t-test is that it is more robust to violations of equal variance because it does not assume equal variance for both groups.5. Repeated measures ANOVA
Just as a t-test is a special case of an ANOVA, a paired t-test is a special case of a repeated measures ANOVA. This test examines if means change across time. In the paired t-test example, we examined scores from only two tests. With a repeated measures ANOVA, we can examine scores from multiple tests. For example, rather than looking at pre- and post-class test scores, we could look at test scores from the same group of students after multiple years of school.6. Repeated measures in R
R does not include running a repeated measures ANOVA in base R. However, we can run an ANOVA on a lmer repeated measures model using the lmerTest package and get a repeated measures ANOVA. Hopefully, you have noticed from this slide how a repeated-measures ANOVA is simply a special type of mixed-effects model.7. Extension to lmer and glmer
As I just demonstrated, lmer() can be used for a repeated-measures ANOVA. However, lmer() can be used to construct other repeated measure models as well. All you need to do is include a time variable and a group variable. Hence, we are able to reuse a powerful tool in R that we have already learned. Also, I would add an important warning that different software, including different functions within R, may use different degrees of freedom with lmer models, which is something we will see in the exercises.8. Let's practice!
Now, let's dive into repeated measures in R.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.