# Lesson 30: Repeated Measures Designs

Lesson 30: Repeated Measures Designs## Overview

In this lesson, we learn how to analyze data arising from repeated measures designs. We'll learn how the ANOVA procedure, the GLM procedure, and MIXED procedure can be used to analyze such data.

## Objectives

Upon completing this lesson, you should be able to do the following:

- use the ANOVA procedure to analyze one-way repeated measures data when the repeated measures are stored across observations in a tall data set
- use the ANOVA procedure's REPEATED statement to analyze one-way repeated measures data when the repeated measures are stored in the same observation as a fat data set
- use the MIXED procedure to analyze a simple one factor mixed-effects model
- use the ANOVA (or GLM) procedure to analyze data arising from two-factor experiments with a repeated measure on one factor
- use the MEANS and GPLOT procedures to create an interaction plot
- use the ANOVA (or GLM) procedure to analyze data arising from two-factor experiments with a repeated measure on both factors

## Textbook Reference

* * Sections A, B, C, D, E, and F in Chapter 8 of the textbook.

# 30.1 - Lesson Notes

30.1 - Lesson Notes### A. Introduction

**Page 237.** The authors mention using the MIXED procedure in place of all of the analyses contained in the chapter to obtain better estimates of the standard errors of the estimates. I fully agree, but we can't possibly digress to learn about mixed models in the scope of this one-credit course. The important thing is that you know that the MIXED procedure exists, so that when you encounter mixed models in your other statistics courses, you can ask if the instructor can discuss mixed model analyses in the context of the MIXED procedure in SAS. Here, we'll focus primarily on alternative ways of analyzing your repeated measures data.

### B. One-Factor Experiments

**Page 240.** Although the authors use the ANOVA procedure here, and throughout the remainder of the chapter, they could have just as easily used the GLM procedure throughout the chapter. Don't forget, in fact, that you have to use the GLM procedure when your design is unbalanced.

### C. Using the Repeated Statement of PROC ANOVA

**Page 243.** Here's another example in which you need to know the structure of the data that SAS expects in order to analyze the data. In the previous example in Section B, SAS expected a tall data set, in which each observation contains a subject's pain score on a particular drug. Here, SAS expects a fat data set, in which each observation contains a subject's pain scores on all four of the drugs.

**Page 245.** In case you want to see the (extensive) output from the SAS code:

```
OPTIONS PS = 58 LS = 72 NODATE NONUMBER;
DATA repeat1;
input subj pain1-pain4;
DATALINES;
1 5 9 6 11
2 7 12 8 9
3 11 12 10 14
4 3 8 5 8
;
RUN;
PROC ANOVA data = repeat1;
title 'One-way ANOVA using the REPEATED statement';
model pain1-pain4 = / NOUNI;
repeated DRUG 4 contrast(1) / NOM SUMMARY;
repeated DRUG 4 contrast(2) / NOM SUMMARY;
repeated DRUG 4 contrast(3) / NOM SUMMARY;
RUN
```

### E. Two-Factor Experiments with a Repeated Measure on One Factor

**Page 252.** The code on this page transposes the fat data set on page 248, in which each observation contains the pre and post times for a subject to a tall data set, in which each observation contains one of the times (pre or post) for a subject.

# 30.2 - Summary

30.2 - SummaryIn this lesson, we learned how to analyze data arising from some basic repeated measures designs.

The homework for this lesson will give you more practice with repeated measures analyses.