Usage Note 22905: Multiple comparison tests in a repeated measures analysis
You can obtain multiple comparison tests in a repeated measures analysis by using the LSMEANS, SLICE, or LSMESTIMATE statements in several procedures. If the response is normally distributed, use PROC MIXED rather than PROC GLM. For other response distributions, use the GLIMMIX, GENMOD, or GEE procedure.
The following example from the PROC MIXED documentation uses the LSMEANS statement to compare means of a between-subjects factor (Gender) adjusting for (averaging over) a within-subjects factor (Age) and their interaction (Gender*Age). The SLICE statement is used to compare Genders at each Age and to compare Ages in each Gender.
data formixed(keep=Person Gender Age Y);
input Person Gender $ y1 y2 y3 y4;
Y=y1; Age=8; output;
Y=y2; Age=10; output;
Y=y3; Age=12; output;
Y=y4; Age=14; output;
datalines;
1 F 21.0 20.0 21.5 23.0
2 F 21.0 21.5 24.0 25.5
3 F 20.5 24.0 24.5 26.0
4 F 23.5 24.5 25.0 26.5
5 F 21.5 23.0 22.5 23.5
6 F 20.0 21.0 21.0 22.5
7 F 21.5 22.5 23.0 25.0
8 F 23.0 23.0 23.5 24.0
9 F 20.0 21.0 22.0 21.5
10 F 16.5 19.0 19.0 19.5
11 F 24.5 25.0 28.0 28.0
12 M 26.0 25.0 29.0 31.0
13 M 21.5 22.5 23.0 26.5
14 M 23.0 22.5 24.0 27.5
15 M 25.5 27.5 26.5 27.0
16 M 20.0 23.5 22.5 26.0
17 M 24.5 25.5 27.0 28.5
18 M 22.0 22.0 24.5 26.5
19 M 24.0 21.5 24.5 25.5
20 M 23.0 20.5 31.0 26.0
21 M 27.5 28.0 31.0 31.5
22 M 23.0 23.0 23.5 25.0
23 M 21.5 23.5 24.0 28.0
24 M 17.0 24.5 26.0 29.5
25 M 22.5 25.5 25.5 26.0
26 M 23.0 24.5 26.0 30.0
27 M 22.0 21.5 23.5 25.0
;
In PROC MIXED you can use the LSMEANS statement to compare Gender means adjusted for the other effects in the model – Age and Age*Gender. Use the SLICE statement to test for simple effects within an interaction.
proc mixed data=formixed;
class Person Gender age;
model y = Gender Age Gender*Age;
repeated Age / type=un subject=Person;
lsmeans Gender / pdiff;
slice Gender*Age / sliceby=Age;
slice Gender*Age / sliceby=Gender diff;
run;
The LSMEANS statement with the PDIFF option produced the following results which show that Females and Males on average differ by -2.32 and the difference is significant (p=0.0054).
F |
M |
-2.3210 |
0.7614 |
25 |
-3.05 |
0.0054 |
|
Results from the first SLICE statement appear next. As Age increases, the difference between Males and Females becomes larger and more significant.
The DIFF option in the second SLICE statement produces pairwise Age differences for each level of the SLICEBY effect (Gender). For Females, the measurements are significantly different between Ages 8 and 12, 8 and 14, and 10 and 14 at alpha level 0.05.
8 |
10 |
-1.0455 |
0.6155 |
25 |
-1.70 |
0.1018 |
8 |
12 |
-1.9091 |
0.6068 |
25 |
-3.15 |
0.0042 |
8 |
14 |
-2.9091 |
0.6729 |
25 |
-4.32 |
0.0002 |
10 |
12 |
-0.8636 |
0.6596 |
25 |
-1.31 |
0.2023 |
10 |
14 |
-1.8636 |
0.4802 |
25 |
-3.88 |
0.0007 |
12 |
14 |
-1.0000 |
0.5377 |
25 |
-1.86 |
0.0747 |
|
For Males, the measurements are significantly different between Ages 8 and 12, 8 and 14, 10 and 12, 10 and 14, and 12 and 14 at alpha level 0.05.
8 |
10 |
-0.9375 |
0.5103 |
25 |
-1.84 |
0.0781 |
8 |
12 |
-2.8437 |
0.5032 |
25 |
-5.65 |
<.0001 |
8 |
14 |
-4.5937 |
0.5579 |
25 |
-8.23 |
<.0001 |
10 |
12 |
-1.9062 |
0.5469 |
25 |
-3.49 |
0.0018 |
10 |
14 |
-3.6562 |
0.3981 |
25 |
-9.18 |
<.0001 |
12 |
14 |
-1.7500 |
0.4458 |
25 |
-3.93 |
0.0006 |
|
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
data formixed(keep=person gender age y);
input Person Gender $ y1 y2 y3 y4;
y=y1; Age=8; output;
y=y2; Age=10; output;
y=y3; Age=12; output;
y=y4; Age=14; output;
datalines;
1 F 21.0 20.0 21.5 23.0
2 F 21.0 21.5 24.0 25.5
3 F 20.5 24.0 24.5 26.0
4 F 23.5 24.5 25.0 26.5
5 F 21.5 23.0 22.5 23.5
6 F 20.0 21.0 21.0 22.5
7 F 21.5 22.5 23.0 25.0
8 F 23.0 23.0 23.5 24.0
9 F 20.0 21.0 22.0 21.5
10 F 16.5 19.0 19.0 19.5
11 F 24.5 25.0 28.0 28.0
12 M 26.0 25.0 29.0 31.0
13 M 21.5 22.5 23.0 26.5
14 M 23.0 22.5 24.0 27.5
15 M 25.5 27.5 26.5 27.0
16 M 20.0 23.5 22.5 26.0
17 M 24.5 25.5 27.0 28.5
18 M 22.0 22.0 24.5 26.5
19 M 24.0 21.5 24.5 25.5
20 M 23.0 20.5 31.0 26.0
21 M 27.5 28.0 31.0 31.5
22 M 23.0 23.0 23.5 25.0
23 M 21.5 23.5 24.0 28.0
24 M 17.0 24.5 26.0 29.5
25 M 22.5 25.5 25.5 26.0
26 M 23.0 24.5 26.0 30.0
27 M 22.0 21.5 23.5 25.0
;
/* In PROC MIXED you may use the LSMEANS statement
* to compare GENDER means adjusted for other effects,
* AGE and AGE*GENDER, in the model.
* You may use the SLICE statement to test for simple effect.
*/
proc mixed data=formixed ;
class Person Gender age;
model y = Gender Age Gender*Age;
repeated age / type=un subject=Person;
lsmeans gender / pdiff;
slice Gender*Age / sliceby=Age;
slice Gender*Age / sliceby=Gender diff;
run;
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> Procedures ==> GLM SAS Reference ==> Procedures ==> MIXED Analytics ==> Analysis of Variance Analytics ==> Longitudinal Analysis Analytics ==> Mixed Models SAS Reference ==> Procedures ==> GEE SAS Reference ==> Procedures ==> GENMOD SAS Reference ==> Procedures ==> GLIMMIX
|
Date Modified: | 2019-07-19 15:49:02 |
Date Created: | 2002-12-16 10:56:40 |