Sei sulla pagina 1di 15

STAT3010: Lecture 7

Repeated Measures Analysis of Variance (Section 9.6,


Page 436)
Repeated Measurements are measurements made on your
subjects over a particular time. The purpose of these repeated
measurements is to assess changes in the measurements of the
subjects over time. For example, a hypothesis might be that
there may be a decreasing effect over time. Heres the data
layout:
Subject
Time 1
Time 2

Time k
1
2
.
.
.
n

x11
x21

x12
x22

x1k
x2 k

xn 2

xnk

.
.
.

xn1

In these applications, we have n subjects, and we take


repeated measurements on each of the n subjects.
Outline of the Procedure:
1. Set up the hypothesis:

2. Compute the test statistic:

STAT3010: Lecture 7

Repeated Measures Analysis of Variance Table


Degrees of
Freedom
(df)

Source of
Variation

Sums of Squares
(SS)

Between

SS subj k ( X s. X .. ) 2

n-1

SS b n( X . j X .. ) 2

k-1

Mean Squares
(MS)

Subjects
Between

s b2 MS b

SS b
k 1

Trtmts
Within

SS w SS total SS subj SS b

Total

SS total SS subj SS b SS w

(n-1)(k-1) s w2 MS w
nk-1

SS w
(n 1)(k 1)

MS b
MS w

STAT3010: Lecture 7

3. Decision Rule:

4. Conclusion.
Example 9.10: Repeated Measures ANOVA to Test Difference
in Mean Completion Times Among 3 Training Courses
Were comparing the cardiovascular fitness of elite runners on
three different training courses, each of which covers 10 miles.
Course 1 is flat, Course 2 has graded inclines and Course 3
includes steep inclines. Each runners heart rate is monitored at
mile 5 of the run on each course. Ten runners are involved, and
their heart rates measured on each course are shown:
Runner Number
1
2
3
4
5
6
7
8
9
10

Course 1

Course 2

132
143
135
128
141
150
131
150
142
139

135
148
138
131
141
156
134
156
145
165

Course 3
138
148
141
139
150
161
138
162
151
160

STAT3010: Lecture 7

Is there a significant difference in the mean heart rates of


runners on the three courses? Run the appropriate test at a 5%
level of significance.
First of all, how is this different from our old examples?
Treatment 1

Treatment 2

29.0
29.2
29.1
28.9
28.8

25.1
25.0
25.0
24.9
25.0

Treatment 3
20.1
20.0
19.9
19.8
20.2

Here, we have a total of 15 people who are randomly assigned


to one of these 3 treatments, where above (page 3), we have
a total of 10 runners who keep getting repeated measurements
taken at different levels.
1. Set up the hypotheses:

2. Compute the test statistic:


Construct an ANOVA, but first:
Runner # Course 1
Course 2
1
2
3
4
5
6
7
8
9
10

132
143
135
128
141
150
131
150
142
139

135
148
138
131
141
156
134
156
145
165

Course 3
138
148
141
139
150
161
138
162
151
160

STAT3010: Lecture 7

The between subjects sums of squares is

The between treatments sums of squares is

The total sums of squares is

The within sums of squares is

Analysis of Variance Table


Source of
Variation

Sums of Squares
(SS)

Degrees of
Freedom
(df)

Between
Subjects
Between
Trtmts
Within
Total

Mean Squares
(MS)

STAT3010: Lecture 7

3. Decision Rule:

4. Conclusion:

Using SAS:
SAS CODE:
options ps=62 ls=80;
data repeatedmeasurments;
input runner course1 course2 course3;
subjmean=mean(course1,course2,course3);
cards;
1
2
3
4
5
6
7
8
9
10

132
143
135
128
141
150
131
150
142
139

135
148
138
131
141
156
134
156
145
165

run;
proc print;
var course1 course2 course3 subjmean;
run;

138
148
141
139
150
161
138
162
151
160

STAT3010: Lecture 7

proc means;
var course1 course2 course3 subjmean;
run;
proc glm;
model course1 course2 course3=/nouni;
repeated course;
run;
SAS OUTPUT:
The SAS System
Obs

course1

course2

course3

subjmean

1
2
3
4
5
6
7
8
9
10

132
143
135
128
141
150
131
150
142
139

135
148
138
131
141
156
134
156
145
165

138
148
141
139
150
161
138
162
151
160

135.000
146.333
138.000
132.667
144.000
155.667
134.333
156.000
146.000
154.667

The SAS System


The MEANS Procedure
Variable
N
Mean
Std Dev
Minimum
Maximum

course1
10
139.1000000
7.6077446
128.0000000
150.0000000
course2
10
144.9000000
11.2195266
131.0000000
165.0000000
course3
10
148.8000000
9.6930674
138.0000000
162.0000000
subjmean
10
144.2666667
9.0769005
132.6666667
156.0000000

The SAS System


The GLM Procedure
Number of Observations Read
Number of Observations Used

10
10

The SAS System


The GLM Procedure
Repeated Measures Analysis of Variance

STAT3010: Lecture 7

Repeated Measures Level Information


Dependent Variable
Level of course

course1
1

course2
2

course3
3

MANOVA Test Criteria and Exact F Statistics


for the Hypothesis of no course Effect
H = Type III SSCP Matrix for course
E = Error SSCP Matrix
S=1
M=0
N=3
Value
F Value

Statistic
Wilks' Lambda
Pillai's Trace
Hotelling-Lawley Trace
Roy's Greatest Root

0.09790213
0.90209787
9.21428275
9.21428275

Num DF

Den DF

Pr > F

2
2
2
2

8
8
8
8

<.0001
<.0001
<.0001
<.0001

36.86
36.86
36.86
36.86

The SAS System


The GLM Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects
Source

DF

Type III SS

Mean Square

F Value

Pr > F

course
Error(course)

2
18

476.4666667
274.8666667

238.2333333
15.2703704

15.60

0.0001

Adj Pr > F
G - G
H - F

Source
course
Error(course)

0.0013

Greenhouse-Geisser Epsilon
Huynh-Feldt Epsilon

0.0009

0.6350
0.6922

Once a significant f-test has been obtained for a repeatedmeasures ANOVA, a post-hoc test (pairwise tests) can be done
to determine which of the means are different. Tests that are
commonly used include the least significant difference (LST)
test, modified Bonferroni t-test, and Sidak test.

STAT3010: Lecture 7

to

The Modified Bonferroni t-test:

x1 x 2
2 MS E
n

with a critical value t-test using table B.3 with error degrees of
freedom. Note: All comparisons must be completed (similar to
the Scheffe Procedure).

Randomized Complete Block Designs


Another type of repeated measurements ANOVA is the
Randomized Complete Block Designs. The most straightforward
of the randomized block designs is one in which we randomly
assign each treatment once to every block - each block
constituting a single replication of the treatments.
A typical layout for the randomized complete block design
(RCB) using 3 measurements in 4 blocks is as follows:
Block 1

Block 2

Block 3

Block 4

t2
t1
t3

t1
t3
t2

t3
t2
t1

t2
t1
t3

The ts denote the assignment to blocks of each of the 3


treatments. Of course, the true allocation of treatments to units
within blocks is done at random. Once the experiment has
been completed, the data can be recorded as in the following
3 x 4 array:
Treatment
1
2
3

Block:

y11
y 21
y 31

y12
y 22
y 32

y13

y14
y 24
y 34

y 23
y 33

STAT3010: Lecture 7

where y11 represents the response obtained by using treatment


1 in block 1, y12 represents the response obtained by using
treatment 1 in block 2, , and y 34 represents the response
obtained by using treatment 3 in block 4.
Example: Four different machines are being considered for the
assembling of a particular product. It is decided that 6
different operators are to be used in a randomized block
experiment to compare the machines. The machines are
assigned in a random order to each operator. The operation of
the machines requires physical dexterity, and it is anticipated
that there will be a difference among the operators in the
speed with which they operate the machines. The amount of
time (in seconds) were recorded for assembling the product:
Operator
Machine
1
2
3
4
Total

1
42.5
39.8
40.2
41.3
163.8

2
39.3
40.1
40.5
42.2
162.1

3
39.6
40.5
41.3
43.5
164.9

4
39.9
42.3
43.4
44.2
169.8

5
42.9
42.5
44.9
45.9
176.2

6
43.6
43.1
45.1
42.3
174.1

Total
247.8
248.3
255.4
259.4
1010.9

Test the hypothesis at the 0.05 level of significance that the


machines perform at the same mean rate of speed.

SAS CODE:
options ps=62 ls=80;
data randomizedblock;
input block machine1 machine2 machine3 machine4;
blockmean=mean(machine1,machine2,machine3,machine4);
cards;
1
42.5 39.8 40.2 41.3
2
39.3 40.1 40.5 42.2
10

STAT3010: Lecture 7

3
39.6 40.5
4
39.9 42.3
5
42.9 42.5
6
43.6 43.1
run;
proc print;
var machine1
run;
proc means;
var machine1
run;

41.3
43.4
44.9
45.1

43.5
44.2
45.9
42.3

machine2 machine3 machine4 blockmean;

machine2 machine3 machine4 blockmean;

proc glm;
model machine1 machine2 machine3 machine4=/nouni;
repeated machine;
run;
SAS OUTPUT:
The SAS System
Obs

machine1

machine2

1
2
3
4
5
6

42.5
39.3
39.6
39.9
42.9
43.6

39.8
40.1
40.5
42.3
42.5
43.1

machine3

40.2
40.5
41.3
43.4
44.9
45.1
The SAS System

machine4

blockmean

41.3
42.2
43.5
44.2
45.9
42.3

40.950
40.525
41.225
42.450
44.050
43.525

The MEANS Procedure


Variable
N
Mean
Std Dev
Minimum
Maximum

machine1
6
41.3000000
1.9047310
39.3000000
43.6000000
machine2
6
41.3833333
1.4119726
39.8000000
43.1000000
machine3
6
42.5666667
2.1924112
40.2000000
45.1000000
machine4
6
43.2333333
1.6609234
41.3000000
45.9000000
blockmean
6
42.1208333
1.4506392
40.5250000
44.0500000

The SAS System


The GLM Procedure
Number of Observations Read
Number of Observations Used

11

6
6

STAT3010: Lecture 7

The SAS System


The GLM Procedure
Repeated Measures Analysis of Variance
Repeated Measures Level Information
Dependent Variable

machine1 machine2 machine3 machine4

Level of machine

MANOVA Test Criteria and Exact F Statistics


for the Hypothesis of no machine Effect
H = Type III SSCP Matrix for machine
E = Error SSCP Matrix
S=1
Statistic
Wilks' Lambda
Pillai's Trace
Hotelling-Lawley Trace
Roy's Greatest Root

M=0.5

N=0.5

Value

F Value

Num DF

Den DF

Pr > F

0.17064463
0.82935537
4.86013150
4.86013150

4.86
4.86
4.86
4.86

3
3
3
3

3
3
3
3

0.1133
0.1133
0.1133
0.1133

The SAS System


The GLM Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects
Source

DF

Type III SS

Mean Square

F Value

Pr > F

machine
Error(machine)

3
15

15.92458333
23.84791667

5.30819444
1.58986111

3.34

0.0479

Source
machine
Error(machine)

Adj Pr > F
G - G
H - F
0.0820

Greenhouse-Geisser Epsilon
Huynh-Feldt Epsilon

12

0.0482

0.6283
0.9963

STAT3010: Lecture 7

One more example in SAS:


Example 9.4: Analysis of Variance (ANOVA): Unequal Sample
Sizes. Compare Mean Ages among Three Groups of Students
The following data reflect ages of students at completion of
eighth grade. Test if there is a significant difference in the
mean age at completion of eighth grade for rural, suburban,
and urban students using SAS and a 5% level of significance.
The following data were collected from randomly selected
students at rural, suburban, and urban schools.
Rural:
14
Suburban: 14
Urban:
16
SAS CODE:

14
14
16

14
14
15

14
13
15

13
13
15

options ps=62 ls=80;


data unequal;
input school $ age;
cards;
rural 14
rural 14
rural 14
rural 14
rural 13
rural 13
rural 13
rural 12
suburban 14
suburban 14
suburban 14
suburban 13
suburban 13
suburban 13
suburban 13

13

13
13
14

13
13
14

12
13
14

12
13

12
12

STAT3010: Lecture 7

suburban
suburban
suburban
urban
urban
urban
urban
urban
urban
urban
urban
urban
urban
run;

13
12
12
16
16
15
15
15
14
14
14
13
12

proc glm;
class school;
model age=school;
run;
SAS OUTPUT:
The SAS System
The GLM Procedure
Class Level Information
Class
school

Levels
3

Values
rural suburban urban

Number of Observations Read


Number of Observations Used

28
28

The SAS System


The GLM Procedure
Dependent Variable: age
Source

DF

Sum of
Squares

Model
Error
Corrected Total

2
25
27

9.25357143
23.17500000
32.42857143

R-Square

Coeff Var

Mean Square

F Value

Pr > F

4.62678571
0.92700000

4.99

0.0150

Root MSE

14

age Mean

STAT3010: Lecture 7
0.285352

7.057234

0.962808

13.64286

Source
school

DF
2

Type I SS
9.25357143

Mean Square
4.62678571

F Value
4.99

Pr > F
0.0150

Source
school

DF
2

Type III SS
9.25357143

Mean Square
4.62678571

F Value
4.99

Pr > F
0.0150

15

Potrebbero piacerti anche