Download Nesting and Crossing and Split Plot Designs - Study Guide | IES 612 and more Study notes Environmental Science in PDF only on Docsity!
IES 612/STA 4-573/STA 4-
Spring 2006 [revised: 17 March 2006]
Week 10 – IES612-week10-lecture.doc
Topics:
i. Nesting/Crossing and Split-Plots
ii. Random/Fixed/Mixed Effects Models
iii. Repeated Measures Data
i. Nesting/Crossing and Split-Plot Designs
Factorial treatment structures represent CROSSING of factors – all levels of one factor are
combined with all levels of other factors.
If Factors are NESTED, then levels of some factor occur within levels of another factor.
Example OL 17.10:
SITE (2 levels) -- FIXED
Batch (3 levels – nested in site) -- RANDOM
Tablet (5 replicates for each BATCH)
yijk = + i + j(i) + ijk
i=1,2; j = 1, 2, 3; and k=1,2,3,4,
data OL17p10;
do site= 1 to 2 ;
do batch = 1 to 3 ;
do tablet = 1 to 5 ;
input content @@;
output;
end;
end;
end;
datalines;
proc print data=OL17p10;
run ;
proc glm data=OL17p10;
title "Using GLM to analyze NESTED factor (OL 17.10)";
class site batch;
model content = site batch(site);
test h=site e=batch(site);
run ;
proc mixed data=OL17p10;
title "Using MIXED to analyze NESTED factor (OL 17.10)";
class site batch;
model content = site;
random batch(site);
run ;
OUTPUT FROM SAS …
Using MIXED to analyze NESTED factor (OL 17.10) 1
Obs site batch tablet content
Using GLM to analyze NESTED factor (OL 17.10) 16
The GLM Procedure
Class Level Information
Class Levels Values
site 2 1 2
batch 3 1 2 3
Class Level Information
Class Levels Values
site 2 1 2
batch 3 1 2 3
Dimensions
Covariance Parameters 2
Columns in X 3
Columns in Z 6
Subjects 1
Max Obs Per Subject 30
Number of Observations
Number of Observations Read 30
Number of Observations Used 30
Using MIXED to analyze NESTED factor (OL 17.10) 20
The Mixed Procedure
Number of Observations
Number of Observations Not Used 0
Iteration History
Iteration Evaluations -2 Res Log Like Criterion
Convergence criteria met.
Covariance Parameter
Estimates
Cov Parm Estimate
batch(site) 0.
Residual 0.01209 <- Between BATCH vs. WITHIN BATCH variability
Fit Statistics
-2 Res Log Likelihood -29.
AIC (smaller is better) -25.
AICC (smaller is better) -25.
BIC (smaller is better) -26.
Using MIXED to analyze NESTED factor (OL 17.10) 21
The Mixed Procedure
Type 3 Tests of Fixed Effects
Num Den
Effect DF DF F Value Pr > F
site 1 4 0.16 0.
proc print data=OL17p11;
run ;
proc glm data=OL17p11;
class fertilizer variety Block;
model yield = fertilizer variety fertilizer*variety
Block fertilizer*Block;
test h=fertilizer e=fertilizer*Block;
run ;
Using MIXED to analyze NESTED factor (OL 17.10) 37 Obs block fertilizer variety yield 1 1 1 1 10. 2 1 1 2 11. 3 1 1 3 11. 4 1 2 1 10. 5 1 2 2 11. 6 1 2 3 12. 7 2 2 2 11. 8 2 2 3 12. 9 2 2 1 11. 10 2 1 2 11. 11 2 1 3 12. 12 2 1 1 10. 13 3 1 3 9. 14 3 1 1 8. 15 3 1 2 8. 16 3 2 3 9. 17 3 2 1 8. 18 3 2 2 9.
Using MIXED to analyze NESTED factor (OL 17.10) 38 The GLM Procedure Class Level Information Class Levels Values fertilizer 2 1 2 variety 3 1 2 3 block 3 1 2 3 Number of Observations Read 18 Number of Observations Used 18
Using MIXED to analyze NESTED factor (OL 17.10) 39 The GLM Procedure Dependent Variable: yield Sum of
Source DF Squares Mean Square F Value Pr > F Model 9 35.09833333 3.89981481 137.64 <. Error 8 0.22666667 0. Corrected Total 17 35. R-Square Coeff Var Root MSE yield Mean 0.993583 1.570685 0.168325 10. Source DF Type I SS Mean Square F Value Pr > F fertilizer 1 0.84500000 0.84500000 29.82 0. variety 2 5.34333333 2.67166667 94.29 <. fertilizervariety 2 0.00333333 0.00166667 0.06 0. block 2 28.86333333 14.43166667 509.35 <. fertilizerblock 2 0.04333333 0.02166667 0.76 0. Source DF Type III SS Mean Square F Value Pr > F fertilizer 1 0.84500000 0.84500000 29.82 0. variety 2 5.34333333 2.67166667 94.29 <. fertilizer*variety 2 0.00333333 0.00166667 0.06 0. block 2 28.86333333 14.43166667 509.35 <.
Using MIXED to analyze NESTED factor (OL 17.10) 40 The GLM Procedure Dependent Variable: yield Source DF Type III SS Mean Square F Value Pr > F fertilizerblock 2 0.04333333 0.02166667 0.76 0. Tests of Hypotheses Using the Type III MS for fertilizerblock as an Error Term Source DF Type III SS Mean Square F Value Pr > F fertilizer 1 0.84500000 0.84500000 39.00 0.
Class Level Information Class Levels Values station 3 1 2 3 Number of Observations Read 15 Number of Observations Used 15
Random effect 60 Ott/Longnecker p. 981 - example 17. The GLM Procedure Dependent Variable: intensity Sum of Source DF Squares Mean Square F Value Pr > F Model 2 20259573.3 10129786.7 1.38 0. Error 12 87989600.0 7332466. Corrected Total 14 108249173. R-Square Coeff Var Root MSE intensity Mean 0.187157 94.06622 2707.853 2878. Source DF Type I SS Mean Square F Value Pr > F station 2 20259573.33 10129786.67 1.38 0. Source DF Type III SS Mean Square F Value Pr > F station 2 20259573.33 10129786.67 1.38 0.
Random effect 61 Ott/Longnecker p. 981 - example 17. The GLM Procedure Source Type III Expected Mean Square station Var(Error) + 5 Var(station)
So, Est. Var(Error) = MSE = 7,332,466.
Est. Var(Station) = [MS(station) – MSE]/5 = [10129786.67 - 7332466.7]/5 = 559,463.
Random effect 62 Ott/Longnecker p. 981 - example 17. The Mixed Procedure Model Information Data Set WORK.DRANEFF Dependent Variable intensity Covariance Structure Variance Components Estimation Method REML Residual Variance Method Profile Fixed Effects SE Method Model-Based Degrees of Freedom Method Containment Class Level Information Class Levels Values station 3 1 2 3 Dimensions
Covariance Parameters 2 Columns in X 1 Columns in Z 3 Subjects 1 Max Obs Per Subject 15 Number of Observations Number of Observations Read 15 Number of Observations Used 15
Random effect 63 Ott/Longnecker p. 981 - example 17. The Mixed Procedure Number of Observations Number of Observations Not Used 0 Iteration History Iteration Evaluations -2 Res Log Like Criterion 0 1 264. 1 1 264.39418117 0. Convergence criteria met. Covariance Parameter Estimates Cov Parm Estimate station 559464
Residual 7332467 <- WITHIN STATION variability > BETWEEN STATION variability
Fit Statistics -2 Res Log Likelihood 264. AIC (smaller is better) 268. AICC (smaller is better) 269. BIC (smaller is better) 266.
* convert "date" to the number of months;
data OL18p2; set OL18p2;
month = 0 *(date= 1 ) + 9 *(date= 2 ) + 12 *(date= 3 ) + 14 *(date= 4 ) +
18 *(date= 5 ) + 21 *(date= 6 ) + 24 *(date= 7 ) + 27 *(date= 8 );
cmonth = month - 13.5 ;
cmonth2 = cmonth** 2 ;
cmonth3 = cmonth** 3 ;
proc print ;
run ;
/* generate mean profile plots */
proc sort ; by treatment month;
proc means noprint; by treatment month;
var response;
output out=dprofile mean=ymean;
run ;
proc print ;
run ;
proc plot data=dprofile;
title3 "Mean profile plot";
plot ymean*month=treatment;
run ;
proc mixed data=OL18p2; * analogous to report in book p. 1037;
class treatment month tract;
model response = treatment month treatment*month;
random intercept / subject=tract(treatment) solution;
lsmeans treatment*month / adjust=bon slice=month;
run ;
proc mixed data=OL18p2; * analogous to report in book p. 1037;
class treatment month tract;
model response = treatment month treatment*month;
repeated / type=cs subject=tract(treatment);
lsmeans treatment*month / adjust=bon slice=month;
run ; [this MIXED output not included since matches previous code]
proc mixed data=OL18p2; * random coefficient - cubic pattern;
class treatment tract;
model response = treatment cmonth cmonth2 cmonth3 / solution;
random intercept / subject=tract(treatment) solution;
run ;
response = # D. spicata observed
Comparing Burned-Control plots overtime (OL 18.2) 77 response = # D. spicata observed The Mixed Procedure Model Information Data Set WORK.OL18P Dependent Variable response Covariance Structure Variance Components Subject Effect tract(treatment) Estimation Method REML Residual Variance Method Profile Fixed Effects SE Method Model-Based Degrees of Freedom Method Containment Class Level Information Class Levels Values treatment 2 0 1 month 8 0 9 12 14 18 21 24 27 tract 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Dimensions Covariance Parameters 2 Columns in X 27 Columns in Z Per Subject 1 Subjects 40 Max Obs Per Subject 8
Comparing Burned-Control plots overtime (OL 18.2) 78 response = # D. spicata observed The Mixed Procedure Number of Observations Number of Observations Read 320 Number of Observations Used 320 Number of Observations Not Used 0 Iteration History Iteration Evaluations -2 Res Log Like Criterion 0 1 2548. 1 1 2000.96130264 0. Convergence criteria met. Covariance Parameter Estimates Cov Parm Subject Estimate Intercept tract(treatment) 197. Residual 21. Fit Statistics -2 Res Log Likelihood 2001. AIC (smaller is better) 2005.
Comparing Burned-Control plots overtime (OL 18.2) 79 response = # D. spicata observed The Mixed Procedure Fit Statistics
Solution for Random Effects
Std Err response = # D. spicata observed Mean profile plot The Mixed Procedure Type 3 Tests of Fixed Effects Num Den
[some output deleted]
Tests of Effect Slices
- Comparing Burned-Control plots overtime (OL 18.2) --------------------------------------------------------------------------
- Obs treatment tract date response month cmonth cmonth2 cmonth response = # D. spicata observed - 1 0 1 1 27 0 -13.5 182.25 -2460. - 2 0 1 2 25 9 -4.5 20.25 -91. - 3 0 1 3 18 12 -1.5 2.25 -3. - 4 0 1 4 21 14 0.5 0.25 0. - 5 0 1 5 26 18 4.5 20.25 91. - 6 0 1 6 22 21 7.5 56.25 421. - 7 0 1 7 20 24 10.5 110.25 1157. - 8 0 1 8 27 27 13.5 182.25 2460. - 9 0 2 1 5 0 -13.5 182.25 -2460.
- 10 0 2 2 15 9 -4.5 20.25 -91.
- 11 0 2 3 10 12 -1.5 2.25 -3.
- 12 0 2 4 12 14 0.5 0.25 0.
- 13 0 2 5 10 18 4.5 20.25 91.
- 14 0 2 6 11 21 7.5 56.25 421.
- 15 0 2 7 12 24 10.5 110.25 1157.
- 16 0 2 8 9 27 13.5 182.25 2460.
- 17 0 3 1 17 0 -13.5 182.25 -2460.
- 18 0 3 2 26 9 -4.5 20.25 -91.
- 19 0 3 3 26 12 -1.5 2.25 -3.
- 20 0 3 4 25 14 0.5 0.25 0.
- 21 0 3 5 15 18 4.5 20.25 91.
- 22 0 3 6 10 21 7.5 56.25 421.
- 23 0 3 7 14 24 10.5 110.25 1157.
- 24 0 3 8 17 27 13.5 182.25 2460.
- 25 0 4 1 41 0 -13.5 182.25 -2460.
- 26 0 4 2 41 9 -4.5 20.25 -91.
- 27 0 4 3 42 12 -1.5 2.25 -3.
- 28 0 4 4 38 14 0.5 0.25 0.
- 29 0 4 5 34 18 4.5 20.25 91.
- 30 0 4 6 26 21 7.5 56.25 421.
- 31 0 4 7 26 24 10.5 110.25 1157.
- 311 1 19 7 8 24 10.5 110.25 1157.
- 312 1 19 8 10 27 13.5 182.25 2460.
- 313 1 20 1 0 0 -13.5 182.25 -2460.
- 314 1 20 2 0 9 -4.5 20.25 -91.
- 315 1 20 3 0 12 -1.5 2.25 -3.
- 316 1 20 4 1 14 0.5 0.25 0.
- 317 1 20 5 0 18 4.5 20.25 91.
- 318 1 20 6 0 21 7.5 56.25 421.
- 319 1 20 7 0 24 10.5 110.25 1157.
- 320 1 20 8 0 27 13.5 182.25 2460.
- Comparing Burned-Control plots overtime (OL 18.2) --------------------------------------------------------------------------
- AICC (smaller is better) 2005.
- BIC (smaller is better) 2008.
- Intercept 0 1 -4.5150 3.5125 266 -1.29 0. Effect treatment tract Estimate Pred DF t Value Pr > |t|
- Intercept 0 2 -17.0977 3.5125 266 -4.87 <.
- Intercept 0 3 -8.9559 3.5125 266 -2.55 0.
- Intercept 0 4 6.2173 3.5125 266 1.77 0.
- Intercept 0 5 -4.8851 3.5125 266 -1.39 0.
- Intercept 0 6 -12.5334 3.5125 266 -3.57 0.
- Intercept 0 7 4.4903 3.5125 266 1.28 0.
- Intercept 0 8 8.4378 3.5125 266 2.40 0.
- Intercept 0 9 -2.2945 3.5125 266 -0.65 0.
- Intercept 0 10 -5.7486 3.5125 266 -1.64 0.
- Intercept 0 11 1.0362 3.5125 266 0.30 0.
- Intercept 0 12 6.2173 3.5125 266 1.77 0.
- Intercept 0 13 7.0809 3.5125 266 2.02 0.
- Intercept 0 14 6.0940 3.5125 266 1.73 0.
- Intercept 0 15 -8.9559 3.5125 266 -2.55 0.
- Intercept 0 16 -5.6252 3.5125 266 -1.60 0.
- Intercept 0 17 24.8447 3.5125 266 7.07 <.
- Intercept 0 18 0.04934 3.5125 266 0.01 0.
- Intercept 0 19 -2.5412 3.5125 266 -0.72 0.
- Intercept 0 20 8.6845 3.5125 266 2.47 0.
- Intercept 1 1 -37.7852 3.5125 266 -10.76 <.
- Intercept 1 2 7.3646 3.5125 266 2.10 0.
- Intercept 1 3 16.1232 3.5125 266 4.59 <.
- Intercept 1 4 12.1756 3.5125 266 3.47 0.
- Intercept 1 5 15.6297 3.5125 266 4.45 <.
- Intercept 1 6 3.6638 3.5125 266 1.04 0.
- Intercept 1 7 4.6507 3.5125 266 1.32 0.
- Intercept 1 8 6.9945 3.5125 266 1.99 0.
- Intercept 1 9 10.2019 3.5125 266 2.90 0.
- Intercept 1 10 6.8712 3.5125 266 1.96 0.
- Intercept 1 11 -8.3021 3.5125 266 -2.36 0.
- Intercept 1 12 15.0129 3.5125 266 4.27 <.
- Intercept 1 13 3.5404 3.5125 266 1.01 0.
- Intercept 1 14 15.1363 3.5125 266 4.31 <.
- Intercept 1 15 5.6376 3.5125 266 1.60 0.
- Intercept 1 16 -16.4439 3.5125 266 -4.68 <.
- Intercept 1 17 0.5798 3.5125 266 0.17 0.
- Intercept 1 18 8.4748 3.5125 266 2.41 0.
- Intercept 1 19 -30.8770 3.5125 266 -8.79 <.
- Intercept 1 20 -38.6487 3.5125 266 -11.00 <.
- Comparing Burned-Control plots overtime (OL 18.2) --------------------------------------------------------------------------
- treatment 1 38 6.56 0. Effect DF DF F Value Pr > F
- month 7 266 19.35 <.
- treatment*month 7 266 4.10 0.
Comparing Burned-Control plots overtime (OL 18.2) 140 response = # D. spicata observed The Mixed Procedure Fit Statistics AICC (smaller is better) 2119. BIC (smaller is better) 2123. Solution for Fixed Effects Standard Effect treatment Estimate Error DF t Value Pr > |t| Intercept 41.6515 3.1765 38 13.11 <. treatment 0 -11.4625 4.4738 38 -2.56 0. treatment 1 0.... cmonth -0.6065 0.09638 277 -6.29 <. cmonth2 -0.02500 0.003884 277 -6.44 <. cmonth3 0.003646 0.000611 277 5.96 <. Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value Pr > F treatment 1 38 6.56 0. cmonth 1 277 39.59 <. cmonth2 1 277 41.42 <. cmonth3 1 277 35.57 <.
Availability (p. 1033) of drug over time as a function of
dose form
data OL18p3;
title "Availability of diff. drug forms over time";
title2 "OL 18.3 (p. 1033)";
do icap = 1 to 2 ;
do subject = 1 to 5 ;
do tt = 0 to 4 ;
if tt = 0 then time = 0.5 ;
else time=tt;
if icap= 1 then form="Tablet ";
else form="Capsule";
input avail @@;
output;
end;
end;
end;
datalines;
proc print data= OL18p3;
var form subject time avail;
run ;
/* generate mean profile plots */
proc sort ; by form time;
proc means noprint; by form time;
var avail;
output out=dprofile2 mean=ymean;
run ;
proc print ;
run ;
proc plot data=dprofile2;
title3 "Mean profile plot";
plot ymean*time=form;
run ;
data OL18p3; set OL18p3;
* define the quadratic term;
time2=time** 2 ;
/* spaghetti plots - individual profiles */
proc plot data=OL18p3;
title3 "Spaghetti plot - tablet";
plot avail*time=subject;
where form="Tablet ";
run ;
proc plot data=OL18p3;
title3 "Spaghetti plot - Capsule";
plot avail*time=subject;
where form= "Capsule";
run ;
proc mixed data=OL18p3; * analogous to report in book p. 1034;
title3 "mixed model results";
class form time subject;
model avail = form time form*time;
random intercept / subject=subject(form) solution;
lsmeans form*time / adjust=bon slice=time;
run ;
/* could use NLMIXED if you have a PK model for availability */
Availability of diff. drug forms over time 143 OL 18.3 (p. 1033) Obs form subject time avail 1 Tablet 1 0.5 50 2 Tablet 1 1.0 75 3 Tablet 1 2.0 120