11 EXAMPLE: EFFECT OF DRUGS ON HEART RATE
Tải bản đầy đủ - 0trang
20
Analysis of Messy Data, Volume III: Analysis of Covariance
TABLE 9.7
PROC MIXED Code to Use REML Estimates of the Variance
Components to Provide Combined Within and Between Block
Estimates of the Models Parameters with Results
proc mixed data=long method=reml;
class herb block;
model y=herb om*herb/solution noint;
contrast ‘b1=b2’ om*herb 1 -1;
random block;
lsmeans herb/diff at om=0.9 cl; lsmeans herb/diff at om=1.0 cl;
lsmeans herb/diff at om=1.1 cl; lsmeans herb/diff at om=1.2 cl;
lsmeans herb/diff at om=1.3 cl; lsmeans herb/diff at om=1.4 cl;
lsmeans herb/diff at om=1.5 cl;
CovParm
block
Residual
Estimate
0.1065
0.2128
Effect
herb
om*herb
NumDF
2
2
DenDF
3
3
FValue
186.47
86.47
ProbF
0.0007
0.0022
Effect
herb
herb
om*herb
om*herb
herb
1
2
1
2
Estimate
12.0000
25.4433
15.5107
4.4609
StdErr
1.4829
1.3379
1.1813
1.1044
df
3
3
3
3
NumDF
1
DenDF
3
FValue
62.41
ProbF
0.0042
Label
b1=b2
tValue
8.09
19.02
13.13
4.04
Probt
0.0039
0.0003
0.0010
0.0273
assigned drug 1 and HR2 and IHR2 are the heart rates and initial heart rates for
those assigned to drug 2.
The variable dif_HR is the difference of the heart rates for drug 1 and drug 2
and the variable dif_IHR is the same difference for the initial heart rates. The
variables sum_HR and sum_IHR are the sums of the respective values within each
block and negIHR2 is the negative of IHR2. The main conclusion from the analysis
of this data set will be that there is not sufficient evidence to conclude the slopes
are unequal. This part of the analysis is accomplished by using PROC MIXED.
Table 9.9 contains the PROC MIXED code to fit the unequal slopes models to the
data set. The contrast statement is used to extract the statistic to test the equal slopes
hypothesis. The last part of Table 9.9 contains the equal slopes test statistic, which
has a significance level of 0.8643, indicating there is not sufficient evidence to
conclude the slopes are unequal.
With that step out of the way, the next step is to fit a common slopes model.
The PROC GLM code in Table 9.10 fits the within block common slope model of
Section 9.7. The estimate of the within block variance component is σˆ ε2 = 12.5364/2 =
6.2682. The second part of Table 9.10 is the inverse of Z0′ Z0, which is used to
© 2002 by CRC Press LLC
Two Treatments in a Randomized Complete Block Design Structure
21
Two Herbicides in RCB
Soy Beans, Bu/acre
40
35
30
25
20
0.90
1.10
1.30
1.50
Organic Matter
Herb 1 Model
Herb 2 95% low
Herb 2 Model
Herb 1 95% Up
Herb 1 95% low
Herb 2 95% Up
FIGURE 9.1 Plot of estimated herbicide models with nonsimultaneous 95% confidence
bands.
Difference of Herbicide Models
6
Herb 1 - Herb 2
4
2
0
-2
-4
-6
0.90
1.10
1.30
1.50
Organic Matter
Difference
95% Lower
95% Upper
FIGURE 9.2 Graph of the difference of the two herbicide models with nonsimultaneous 95%
confidence band.
© 2002 by CRC Press LLC
22
Analysis of Messy Data, Volume III: Analysis of Covariance
TABLE 9.8
Data for Effect of Drugs of Heart Rate
data heart; input pair HR1 IHR1 HR2 IHR2;
dif_HR=HR1-HR2; sum_HR=HR1+HR2;dif_IHR=IHR1-IHR2; Sum_IHR=IHR1+IHR2;
negIHR2=-IHR2;
pair
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HR1
60
45
73
63
66
51
77
80
69
53
58
55
52
86
60
59
53
74
64
66
IHR1
85
67
87
83
87
67
99
105
87
67
68
68
77
104
77
68
75
97
83
92
HR2
56
69
60
60
76
69
64
57
86
71
62
79
69
78
65
94
63
62
76
82
IHR2
78
94
68
76
89
83
80
67
104
81
72
90
87
90
84
105
74
85
97
103
dif_HR
4
–24
13
3
–10
–18
13
23
–17
–18
–4
–24
–17
8
–5
–35
–10
12
–12
–16
sum_HR
116
114
133
123
142
120
141
137
155
124
120
134
121
164
125
153
116
136
140
148
dif_IHR
7
–27
19
7
–2
–16
19
38
–17
–14
–4
–22
–10
14
–7
–37
1
12
–14
–11
Sum_IHR
163
161
155
159
176
150
179
172
191
148
140
158
164
194
161
173
149
182
180
195
negIHR2
–78
–94
–68
–76
–89
–83
–80
–67
–104
–81
–72
–90
–87
–90
–84
–105
–74
–85
–97
–103
compute Σˆ w . The within block estimate of the common slope is 0.8245 and the
estimate of the difference of the intercepts is –4.0617. Table 9.11 contains the PROC
GLM code to fit the between block common slope model to the block totals. The
estimate of the block variance component is σˆ 2b = (69.5030/2 – σˆ ε2 )/2 = 14.24166.
The second part of the table contains the inverse of M1′ M1, which can be used to
compute Σˆ b . The between block estimate of the slope is 0.7465 and the estimate of
the sum of the intercepts is 8.0531. The PROC IML code in Tables 9.16 can be used
to compute the combined within and between block parameter estimates. Table 9.12
contains the PROC MIXED code to carry out the combined analysis of the data set.
The combined estimate of the slope is 0.8148. Part five of Table 9.12 contains the
estimated adjusted means, which have estimated standard error of 1.0149. The last
part of Table 9.12 contains the estimated difference of the two regression models
(they are parallel) with estimate difference of –4.0925 and estimated standard error
of 0.8031. The test for comparing the two adjusted means has a significance level
of 0.0001, indicating the two drugs are different.
Finally, Table 9.13 contains the PROC MIXED code to use REML to estimate
the variance components. The estimates are σˆ ε2 = 6.2414 and σˆ b2 = 13.7478. The
© 2002 by CRC Press LLC
Two Treatments in a Randomized Complete Block Design Structure
TABLE 9.9
PROC MIXED Code to Fit the Unequal Slopes Model
to the Drug Data Set with Results
proc mixed data=long method=reml;
class drug pair;
model hr=drug ihr*drug/solution noint;
contrast ‘b1=b2’ ihr*drug 1 –1;
random pair;
CovParm
pair
Residual
Estimate
13.8550
6.4962
Effect
drug
ihr*drug
NumDF
2
2
DenDF
17
17
FValue
0.38
182.02
ProbF
0.6904
0.0000
Effect
drug
drug
ihr*drug
ihr*drug
drug
1
2
1
2
Estimate
–4.2987
1.1552
0.8217
0.8054
StdErr
5.0154
5.7988
0.0598
0.0669
df
17
17
17
17
NumDF
1
DenDF
17
FValue
0.03
ProbF
0.8643
Label
b1=b2
tValue
–0.86
0.20
13.74
12.04
Probt
0.4033
0.8445
0.0000
0.0000
TABLE 9.10
PROC GLM Code to Fit the Within Block Common Slopes
Model to the Heart Rate Data with Results
PROC GLM data=heart;
MODEL DIF_hr=dif_IHR/SOLUTION INVERSE;*--model
for differences;
Parameter
Intercept
dif_IHR
Intercept
0.0516
0.0005
dif_IHR
0.0005
0.0002
Source
Model
Error
Corr Total
df
1
18
19
SS
4220.5451
225.6549
4446.2000
MS
4220.5451
12.5364
FValue
336.66
Source
dif_IHR
df
1
SS (III)
4220.5451
MS
4220.5451
FValue
336.66
Estimate
–4.0617
0.8245
StdErr
0.8047
0.0449
tValue
–5.05
18.35
Probt
0.0001
0.0000
Parameter
Intercept
dif_IHR
© 2002 by CRC Press LLC
ProbF
0.0000
23
24
Analysis of Messy Data, Volume III: Analysis of Covariance
TABLE 9.11
PROC GLM Code to Fit the Between Common Slopes Model
to the Heart Rate Data with Results
PROC GLM data=heart;
MODEL SUM_hr=sum_ihr/SOLUTION INVERSE;*--model for pair sums;
Parameter
Intercept
Sum_IHR
Intercept
5.8312
–0.0345
Sum_IHR
–0.0345
0.0002
Source
Model
Error
Corr Total
df
1
18
19
SS
2704.7453
1251.0547
3955.8000
MS
2704.7453
69.5030
FValue
38.92
ProbF
0.0000
Source
Sum_IHR
df
1
SS (III)
2704.7453
MS
2704.7453
FValue
38.92
ProbF
0.0000
Parameter
Intercept
Sum_IHR
Estimate
8.0531
0.7465
StdErr
20.1317
0.1197
tValue
0.40
6.24
Probt
0.6938
0.0000
combined estimate of the slope is 0.8146. The fifth part of Table 9.13 contains the
estimated adjusted means, which are very similar to those in Table 9.12, but the
estimates of the standard deviations are a little smaller when computed using the
REML estimates of the variance components. Again the combined estimates of the
model’s parameters depend on the values of the variance components, which depend
on the method of variance component estimation.
9.12 SUMMARY
This chapter presents a very interesting problem that occurs when blocking or some
other random effects are used in the model where there are covariates to be considered. Information about the slopes of the model can come from within the intersection of all of the random effects as well as from between the levels of each of the
random effects. This is an important problem for split-plot and repeated measures
types of designs. These topics are to be discussed in the following chapters. Finally,
the combining of within and between block estimates occurs when the mixed models
analysis is used.
© 2002 by CRC Press LLC
Two Treatments in a Randomized Complete Block Design Structure
25
TABLE 9.12
PROC MIXED Code to Carry Out the Combined Within and Between
Block Analysis for the Common Slopes Model
proc mixed data=long method=reml;
class drug pair;
model hr=drug ihr/solution noint;
random pair;
lsmeans drug/diff;
parms (14.24166) (6.26819)/hold=1,2;
CovParm
pair
Residual
Estimate
014.2417
006.2682
Effect
drug
ihr
NumDF
2
1
DenDF
18
18
FValue
13.84
375.21
ProbF
0.0002
0.0000
Effect
drug
drug
ihr
drug
1
2
Estimate
–3.7381
0.3544
0.8148
StdErr
3.6010
3.7304
0.0421
df
18
18
18
tValue
–1.04
0.10
19.37
Probt
0.3130
0.9254
0.0000
Effect
drug
drug
drug
1
2
Estimate
64.5037
68.5963
StdErr
1.0149
1.0149
df
18
18
tValue
63.56
67.59
Probt
0.0000
0.0000
Effect
drug
drug
1
_drug
2
Estimate
–4.0925
StdErr
0.8031
df
18
tValue
–5.10
© 2002 by CRC Press LLC
Probt
0.0001
26
Analysis of Messy Data, Volume III: Analysis of Covariance
TABLE 9.13
PROC MIXED Code to Use REML As a Method to Estimate
the Variance Components for Use in the Combined Within
and Between Block Analysis with Results
proc mixed data=long method=reml;
class drug pair;
model hr=drug ihr/solution noint;
random pair;
lsmeans drug/diff;
CovPar m
pair
Residu al
Estimate
13.7478
6.2414
Effect
drug
ihr
NumDF
2
1
DenDF
18
18
FValue
13.90
377.81
ProbF
0.0002
0.0000
Effect
drug
drug
ihr
drug
1
2
Estimate
–3.7204
0.3728
0.8146
StdErr
3.5851
3.7140
0.0419
df
18
18
18
tValue
–1.04
0.10
19.44
Probt
0.3131
0.9212
0.0000
Effect
drug
drug
drug
1
2
Estimate
64.5034
68.5966
StdErr
1.0020
1.0020
df
18
18
tValue
64.38
68.46
Probt
0.0000
0.0000
Effect
drug
drug
1
_drug
2
Estimate
–4.0932
StdErr
0.8013
df
18
tValue
–5.11
© 2002 by CRC Press LLC
Probt
0.0001
Two Treatments in a Randomized Complete Block Design Structure
TABLE 9.14
PROC IML Code to Combine Within and Between Block Information
and Finish the Computations for the Herbicide Example
proc iml;
bw={–13.82302281, 16.95662402, 5.645132210};
sbw=.479144725*{7.5830055428 –4.265247955 1.7827637526,
–4.265247955
10.78674209 7.63433986,1.7827637526 7.63433986 9.42682557};
bb={38.48854914, 13.83912245, 5.32201593};
sbb=1.08378847*{7.5830055428 –4.265247955 –1.7827637526, –4.265247955
10.78674209 –7.63433986,–1.7827637526 –7.63433986 9.42682557};
print bw sbw bb sbb;
hw={1 –1 0 0 , 0 0 1 0 , 0 0 0 1};
hb={1 1 0 0 , 0 0 1 0 , 0 0 0 1};
isbw=inv(sbw); isbb=inv(sbb);
bc=inv(hw`*isbw*hw+hb`*isbb*hb)*(hw`*isbw*bw+hb`*isbb*bb);
sbc=inv(hw`*isbw*hw+hb`*isbb*hb);
dia=diag(sbc); dia=dia*{1 1 1 1}`;
dia=sqrt(dia); si=inv(sbc);
print bc dia; print bc sbc si;
* compute test of b1=b2;
j={1, 1};
h={0 0 1 0, 0 0 0 1};
betas=h*bc; vbetas=h*sbc*h`;
iv=inv(vbetas); uc=betas`*(iv–iv*j*inv(j`*iv*j)*j`*iv)*betas;
print uc;
TABLE 9.15
PROC IML Code to Construct Confidence Band about Difference
of the Herbicide Models
x={1 –1 .9 –.9, 1 –1 1 –1, 1 –1 1.1 –1.1, 1 –1 1.2 –1.2,
1 –1 1.3 –1.3, 1 –1 1.4 –1.4, 1 –1 1.5 –1.5, 1 –1 1.6 –1.6};
dif=x*bc; vardif=x*sbc*x`;
dia=diag(vardif);
dia=dia*{1 1 1 1 1 1 1 1}`;
dia=sqrt(dia);
*dif is difference and dia is standard error;
print dif dia x;
*compute adjusted means at x=0.9 and x=1.6;
x={1 0 .9 0, 0 1 0 .9, 1 0 1.6 0 , 0 1 0 1.6};
dif=x*bc; vardif=x*sbc*x`;
dia=diag(vardif); dia=dia*{1 1 1 1 }`;
dia=sqrt(dia);
*dif is adjusted mean and dia is standard error;
print dif dia x;
© 2002 by CRC Press LLC
27
28
Analysis of Messy Data, Volume III: Analysis of Covariance
TABLE 9.16
PROC IML Code to Combine Within and Between Pair Estimates
of the Slopes and Test the Equality of Slopes Using the Combined
Estimates for the Drug Data Set
Proc IML;
bw={–7.336075 , .842023 , .8030000};
sbw=13.1665*{5.9293706 –.031022 0.0390255 , –.031022 .0003302
–.000045 , 0.0390255 –.000045 .0004133 };
bb={7.136951325, .713955852, .788653490};
sbb=73.08841*{5.9293706 –.031022 –0.0390255 , –.031022 .0003302
.0000455 , –0.0390255 .0000455 .0004133665};
print bw sbw bb sbb;
hw={1 –1 0 0 , 0 0 1 0 , 0 0 0 1}; hb={1 1 0 0 , 0 0 1 0 , 0 0 0 1};
isbw=inv(sbw); isbb=inv(sbb);
bc=inv(hw`*isbw*hw+hb`*isbb*hb)*(hw`*isbw*bw+hb`*isbb*bb);
sbc=inv(hw`*isbw*hw+hb`*isbb*hb);
dia=diag(sbc); dia=dia*{1 1 1 1}`; dia=sqrt(dia);
si=inv(sbc); print bc dia;
*test b1=b2;
j={1, 1}; h={0 0 1 0, 0 0 0 1};
betas=h*bc; vbetas=h*sbc*h`;
iv=inv(vbetas); uc=betas`*(iv–iv*j*inv(j`*iv*j)*j`*iv)*betas;
print uc;
TABLE 9.17
PROC IML Code to Combine Between and Within Block Information
for Common Slope Model for the Drug Data Set
Proc IML; bw={–4.061747085, .824454036};
sbw=12.53638*{0.0516491658 0.0005153 , 0.0005153 0.0001610513};
bb={8.053121780, 0.746548527};
sbb=69.50304*{5.8312178034 –.034514733, –.034514733 .0002060581};
print bw sbw bb sbb;
hw={1 –1 0 , 0 0 1}; hb={1 1 0 , 0 0 1};
isbw=inv(sbw); isbb=inv(sbb);
bc=inv(hw`*isbw*hw+hb`*isbb*hb)*(hw`*isbw*bw+hb`*isbb*bb);
sbc=inv(hw`*isbw*hw+hb`*isbb*hb);
dia=diag(sbc); dia=dia*{1 1 1}`;
dia=sqrt(dia); si=inv(sbc);
print bc dia; print bc sbc si;
*compare the intercepts–like comparing LSMEANS for parallel lines model;
x={1 –1 0}; dif=x*bc; vardif=x*sbc*x`;
dia=diag(vardif); dia=dia*{1 }`; dia=sqrt(dia);
print dif dia x;
Compute adjusted means for x=70, 100 and 83.75;
x={1 0 70, 0 1 70, 1 0 100 , 0 1 100, 1 0 83.75, 0 1 83.75};
dif=x*bc; vardif=x*sbc*x`; dia=diag(vardif); dia=dia*{1 1 1 1 1 1}`;
dia=sqrt(dia); print dif dia x; run;
© 2002 by CRC Press LLC
Two Treatments in a Randomized Complete Block Design Structure
29
REFERENCES
Ash, Katherine (1982). Use of Inter-Block Information in Analysis of Covariance and Some
Repeated Measures Covariance Models, Ph.D. dissertation, Department of Statistics,
Kansas State University, Manhattan.
Fergen, Brian (1997). On the Mixed-Models Estimator, Ph.D. dissertation, Department of
Statistics, Kansas State University, Manhattan.
John, P. W. M. (1971). Statistical Design and Analysis of Experiments, New York: MacMillan.
Littell, R., Milliken, G. A., Stroup, W., Wolfinger, R. (1996). SAS System for Mixed Models,
Cary NC: SAS Institute Inc.
Milliken, G. A. and Johnson, D. E. (1992). Analysis of Messy Data, Volume I: Design
Experiments, London: Chapman & Hall.
EXERCISES
EXERCISE 9.1: A boy and a girl were selected from each of 16 sixth grade classes
to determine if there were gender differences on the ability to perform on an
engineering and mathematics aptitude test. Each student’s IQ was obtained as a
possible covariate. Provide the estimates of the between block model parameters
and the within block model parameters. Determine if the slopes are similar or
different. Provide a combined within and between block analysis and make the
necessary comparisons between the regression line for the boys and the regression
line for the girls. School is the blocking factor.
Data for Exercise 9.1
School
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
© 2002 by CRC Press LLC
Male_score
83
76
81
85
70
65
65
82
79
81
67
72
83
79
63
84
Male_IQ
120
115
126
123
95
93
94
124
119
116
89
102
125
111
88
127
Female_score
75
55
62
59
68
78
74
76
88
59
86
81
63
86
79
71
Female_IQ
113
96
102
96
105
117
115
115
127
95
125
120
103
124
119
109
30
Analysis of Messy Data, Volume III: Analysis of Covariance
EXERCISE 9.2: A chemical engineer designed a study to evaluate the ability of
a wafer cleaning machine to remove particles from the surface of a silicon wafer
used in the manufacture of semi-conductors. The specific study was to see if the
machine cleaned two types of wafers differently after each had been exposed to a
processing step that leaves particles on the surface. The particles must be removed
before continuing with the development. The cleaning machine had two slots, so
two wafers could be cleaned at the same time or during one run. The process was
to randomly select a wafer of each type from a lot of wafers and then randomly
assign the two wafers to the two wafer slots in the machine. The number of particles
on the surface of each wafer was determined before the cleaning process started and
was to be used as a possible covariate. After the cleaning process, the number of
particles remaining on the surface was determined. Use the following data to obtain
the within and between block or run estimates of the parameters of the models and
then obtain the combined estimates. Determine if there is evidence that the two
slopes are unequal. Complete the analysis by comparing the resulting regression
models for the two wafer types.
Data set for Exercise 9.2
Run
1
2
3
4
5
6
7
8
9
10
11
12
A_pre_part
214
159
179
160
188
225
218
221
259
155
252
235
A_rem_part
56
36
43
44
51
56
52
56
63
45
62
58
B_pre_part
236
219
255
245
154
148
153
248
234
222
137
179
B_rem_part
77
63
73
80
53
39
42
75
68
73
48
58
EXERCISE 9.3: Use change from baseline (pre_part – rem_part) in Exercise 9.2
and use the randomized complete block analysis of variance to compare the wafer
types. Were the conclusions similar?
EXERCISE 9.4: Use the change from baseline (IHR – HR) in Section 9.11 and
use the randomized complete block analysis of variance to compare the two drugs.
Are the conclusions similar?
© 2002 by CRC Press LLC