Repeated Measures Designs
I’m going to illustrate the use of SAS to help solve
repeated measures design experiments.
The first illustration i
page 1032. I’ll do it using two
separate SAS methods.
Method 1, SAS Program.
title 'Example 18.1, page 1032';
data drug;
input Subj
DosageForm $ T1 T2 T3 T4 T5;
datalines;
1 T 50 75 120 60 30
2 T 40 80 135 70 40
3 T 55 75 125 85 50
4 T 70 85 140 90 40
5 T 60 90 150 95 50
6 C 30 55 80 130 65
7 C 25 50 75 125 60
8 C 35 65 85 140 85
9 C 45 70 90 145 80
10 C 50 75 95 160 90
;
proc anova;
class DosageForm;
model T1 T2 T3 T4 T5 = DosageForm / nouni;
repeated Time 5 (.5 1 2 3 4);
means DosageForm;
run;
Method 1, SAS Output.
Example 18.1, page 1032
The ANOVA Procedure
Class Level Information
Class Levels Values
DosageForm
2 C T
Number of observations 10
Example 18.1, page 1032
The ANOVA Procedure
Repeated Measures Analysis of Variance
Repeated Measures Level Information
Dependent Variable
T1 T2 T3
T4 T5
Level of
Time 0.5 1
2 3 4
Example 18.1, page 1032
The ANOVA Procedure
Repeated Measures Analysis of Variance
MANOVA
Test Criteria and Exact F Statistics
for the Hypothesis of no Time Effect
H
= Anova SSCP Matrix for Time
E = Error SSCP Matrix
S=1 M=1
N=1.5
Statistic Value F Value
Num DF Den DF
Wilks' Lambda 0.00587399 211.55 4
5
Pillai's Trace 0.99412601 211.55 4
5
Hotelling-Lawley Trace 169.24212349 211.55 4
5
Statistic Pr > F
Wilks' Lambda
<.0001
Pillai's Trace
<.0001
Hotelling-Lawley Trace
<.0001
Example 18.1, page 1032
The ANOVA Procedure
Repeated Measures Analysis of Variance
MANOVA
Test Criteria and Exact F Statistics for
the Hypothesis of no Time*DosageForm
Effect
H = Anova SSCP Matrix for Time*DosageForm
E = Error SSCP Matrix
S=1 M=1
N=1.5
Statistic Value F Value
Num DF Den DF
Wilks' Lambda 0.00688490 180.31 4
5
Pillai's Trace 0.99311510 180.31 4
5
Hotelling-Lawley Trace 144.24534293 180.31 4
5
Statistic Pr > F
Wilks' Lambda
<.0001
Pillai's Trace
<.0001
Hotelling-Lawley Trace
<.0001
Example 18.1, page 1032
The ANOVA Procedure
Repeated Measures Analysis of Variance
Tests of
Hypotheses for Between Subjects Effects
Source
DF Anova
SS Mean Square F Value
DosageForm 1 40.500000 40.500000 0.08
Error
8 3920.000000 490.000000
Source Pr > F
DosageForm
0.7810
Error
Example 18.1, page 1032
The ANOVA Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects
Source
DF Anova
SS Mean Square F Value
Time
4 34288.00000 8572.00000
279.90
Time*DosageForm 4
19472.00000 4868.00000 158.96
Error(Time) 32 980.00000 30.62500
Adj Pr > F
Source Pr > F G - G
H - F
Time <.0001 <.0001
<.0001
Time*DosageForm
<.0001 <.0001 <.0001
Error(Time)
Example 18.1, page 1032
The ANOVA Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects
Greenhouse-Geisser Epsilon 0.7374
Huynh-Feldt Epsilon 1.3610
Example 18.1, page 1032
The ANOVA Procedure
Level of
------------T1----------- ------------T2-----------
DosageForm N Mean Std Dev Mean Std Dev
C 5 37.0000000
10.3682207 63.0000000 10.3682207
T 5 55.0000000
11.1803399 81.0000000 6.5192024
Level of
------------T3----------- ------------T4-----------
DosageForm N Mean Std Dev Mean Std Dev
C 5 85.000000
7.9056942 140.000000
13.6930639
T 5 134.000000
11.9373364 80.000000 14.5773797
Level
of --------------T5-------------
DosageForm N
Mean Std
Dev
C 5
76.0000000 12.9421791
T 5
42.0000000 8.3666003
Method 1, Discussion.
In thi
Factors
o DosageForm
– 2 levels: Tablet (T) and Capsule (C)
o Time – 5 levels: 0.5, 1.0,
2.0, 3.0, and 4.0 hours
The data set drug is created by the above data step.
Next, note that proc anova uses the repeated
statement. The repeated statement indicates that we want to call the repeated
factor Time, that it has five levels, and that we want to label the levels .5,
1, 2, 3, and 4.
The MANOVA Test Criteria on the output listing has rows
labeled Wilk’s Lambda, Pillai’s
Trace, etc. These are multivariate statistics that are of interest when more
than one dependent variable is indicated. In our case, the model statement
model T1 T2 T3 T4 T5 = DosageForm
implies that all five of T1, T2,
T3, T4, and T5 are dependent variables.
Unlike in the univariate case, the is no single test analogous to the F test.
If the difference
among the five Time values. In
addition, the tests show there i
The F-statistic for DosageForm
(F = 0.08 , p = 0.7810) tells us that DosageForm is not significant. This is not of much use,
since it combines the measures over all five Time levels. The same logic is true for Time, since we
would be summing over the two DosageForm levels. The
significant interaction term (F = 158.96, p < 0.0001) tells us that the
change from various Times was different, depending on which DosageForm
(C or T) group a subject belongs to.
Looking at the Profile Plot, we see that for times up to
2 hours, higher concentrations of the drug are present for the Tablet DosageForm. But for times 3.0 and 4.0 hours, the Capsule DosageForm has higher concentrations of the drug.

Method 2, SAS Program.
data drug2;
set drug;
Time = '0.5';
Plasma = T1;
output;
Time = '1.0';
Plasma = T2;
output;
Time = '2.0';
Plasma = T3;
output;
Time = '3.0';
Plasma = T4;
output;
Time = '4.0';
Plasma = T5;
output;
keep Subj DosageForm
Time Plasma;
run;
proc anova
data=drug2;
title '
class Subj
DosageForm Time;
model Plasma = DosageForm Subj(DosageForm) Time
DosageForm*Time Time*Subj(DosageForm);
means DosageForm|Time;
test H=DosageForm E=Subj(DosageForm);
test H=Time DosageForm*Time E=Time*Subj(DosageForm);
run;
proc means data=drug2 noprint nway;
class DosageForm
Time;
var
Plasma;
output out=profile mean=;
run;
options linesize=67
pagesize=24;
symbol1 value=circle color=blue interpol=join;
symbol2 value=square color=red interpol=join;
proc gplot
data=profile;
title 'Profile Plot';
plot Plasma*Time=DosageForm;
run;
Method 2, SAS Output.
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Class Level Information
Class Levels Values
Subj
10 1 2 3 4 5 6 7 8 9 10
DosageForm
2 C T
Time 5
0.5 1.0 2.0 3.0 4.0
Number of observations 50
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Dependent Variable: Plasma
Sum of
Source
DF Squares Mean Square F Value
Model 49 58700.50000 1197.96939 .
Error 0 0.00000 .
Corrected Total
49 58700.50000
Source Pr > F
Model .
Error
Corrected Total
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Dependent Variable: Plasma
R-Square Coeff
Var Root
MSE Plasma Mean
1.000000 . . 79.30000
Source
DF Anova
SS Mean Square F Value
DosageForm 1 40.50000 40.50000 .
Subj(DosageForm) 8
3920.00000 490.00000 .
Time 4 34288.00000 8572.00000 .
Source Pr > F
DosageForm .
Subj(DosageForm) .
Time .
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Dependent Variable: Plasma
Source
DF Anova
SS Mean Square F Value
DosageForm*Time 4 19472.00000 4868.00000 .
Subj*Time(DosageFor)
32 980.00000 30.62500 .
Source Pr > F
DosageForm*Time .
Subj*Time(DosageFor) .
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Level
of
------------Plasma-----------
DosageForm
N Mean Std Dev
C 25 80.2000000 36.1847113
T 25 78.4000000 33.6872874
Level
of
------------Plasma-----------
Time N Mean Std Dev
0.5 10 46.000000 13.9044357
1.0 10 72.000000 12.5166556
2.0 10 109.500000 27.5328087
3.0 10
110.000000 34.3187671
4.0 10 59.000000 20.6559112
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Level of Level of ------------Plasma-----------
DosageForm
Time N Mean Std Dev
C 0.5 5 37.000000 10.3682207
C 1.0 5 63.000000 10.3682207
C 2.0 5 85.000000 7.9056942
C 3.0 5 140.000000 13.6930639
C 4.0 5 76.000000 12.9421791
T 0.5 5 55.000000 11.1803399
T 1.0 5
81.000000 6.5192024
T 2.0 5 134.000000 11.9373364
T 3.0 5 80.000000 14.5773797
T 4.0 5 42.000000 8.3666003
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Dependent Variable: Plasma
Tests
of Hypotheses Using the Anova MS
for Subj(DosageForm)
a
Source
DF Anova SS Mean Square F Value
DosageForm 1 40.50000000
40.50000000
0.08
Source Pr > F
DosageForm
0.7810
Two-Way ANOVA, Time a Repeated Measure
The ANOVA Procedure
Dependent Variable: Plasma
Tests of
Hypotheses Using the Anova MS for
Subj*Time(DosageFor)
a
Source
DF Anova
SS Mean Square F Value
Time
4 34288.00000 8572.00000
279.90
DosageForm*Time 4
19472.00000 4868.00000 158.96
Source Pr > F
Time <.0001
DosageForm*Time <.0001
Method 2, Discussion.
In this method we analyze the problem a
In the model statement of proc anova
we have to specify all the terms, including the sources of error. This is so
because the main effect
In this design, we have one group of subject
Since the model statement define
Note that in the Tests portion of the output we get the
same result
For a profile plot we need the Plasma means for each Time
value. We use
proc means to create the data
set profile containing DosageForm, Time, and Plasma
(here Plasma is the mean Plasma). For example, the first observation
(out of 10) in the profile data set is: C 0.5 37. This is the data required for the profile plot generated by proc gplot.