Lab 5_2014.doc

advertisement
Lab 5: 2 factor ANOVA: Random effect and mixed models:
1. A company was interested in comparing three different display panels for use by air traffic controllers.
Each display panel was to be examined under five different simulated emergency conditions, which was
chosen from a variety of conditions. Thirty highly trained air traffic controllers with similar work
experience were enlisted for the study. A random assignment of controllers to display-panel-emergency
conditions was made, with two controllers assigned to each factor-level combination. The time (in
seconds) required to stabilize the emergency situation was recorded for each controller at a panelemergency condition. These data appear below.
Emergency Condition
Display Panel
1
2
3
4
5
1
18 16
31
35
22
27
39
36
15
12
2
13 15
33
30
24
21
35
38
10
16
3
24 28
42
46
40
37
52
57
28
24
Perform your ANOVA to check for effects for interaction, and main effects and do the necessary followups.
/*program to do two way ANOVA with interaction,one fixed one random and do
diagnostics and interaction plots*/
data airtraffic;
input a
b
unit y;
cards;
1
1
1
18
1
1
2
16
1
2
1
31
1
2
2
35
1
3
1
22
1
3
2
27
1
4
1
39
1
4
2
36
1
5
1
15
1
5
2
12
2
1
1
13
2
1
2
15
2
2
1
33
2
2
2
30
2
3
1
24
2
3
2
21
2
4
1
35
2
4
2
38
2
5
1
10
2
5
2
16
3
1
1
24
3
1
2
28
3
2
1
42
3
2
2
46
3
3
1
40
3
3
2
37
3
4
1
52
3
4
2
57
3
5
1
28
3
5
2
24
;
/*using glm which is OLS based*/
proc glm data=airtraffic;
class a b;
model y=a b a*b;
random b a*b/test;
lsmeans a / adjust=tukey e=a*b;
lsmeans a*b / out=out_ls;
output out=out p=py r=ry;
run;
symbol1 color="red" v="star" interpol=join;
symbol2 color="blue" v="star" interpol=join;
symbol3 color="green" v="star" interpol=join;
symbol4 color="black" v="star" interpol=join;
symbol5 color="cyan" v="star" interpol=join;
proc gplot data=out_ls;
/* Interaction Plot */
plot lsmean*a=b;
/* cell mean v. a by b */
plot lsmean*b=a;
/* cell mean v. b by a */
run;
goptions reset;
symbol1 color="red" v="star" interpol=none;
symbol2 color="black" v="circle" interpol=join;
proc gplot data=out;
/* Diagnostic Plots */
plot y*py py*py / overlay; /* observed v. predicted */
plot ry*py;
/* residual v. predicted */
run;
proc capability data=out normaltest;
var ry;
qqplot;
run;
/*program to do two way ANOVA with interaction,one fixed one random and do
diagnostics and interaction plots using PROC MIXED*/
proc mixed data=airtraffic method=type3;
class a b;
model y= a /outp=alc2 residuals ;
random b a*b;
lsmeans a /adjust=tukey;
run;
/* for interaction plots we need to work a bit more*/
proc means data=airtraffic;
by a b;
var y;
output out=outm mean=ym;
run;
symbol1 color="red" v="star" interpol=join;
symbol2 color="blue" v="star" interpol=join;
symbol3 color="green" v="star" interpol=join;
symbol4 color="black" v="star" interpol=join;
symbol5 color="cyan" v="star" interpol=join;
proc gplot data=outm;
/* Interaction Plot */
plot ym*a=b;
/* cell mean v. a by b */
plot ym*b=a;
/* cell mean v. b by a */
run;
goptions reset;
symbol1 color="red" v="star" interpol=none;
symbol2 color="black" v="circle" interpol=join;
proc gplot data=alc2;
/* Diagnostic Plots */
plot y*pred pred*pred / overlay; /* observed v. predicted */
plot resid*pred;
/* residual v. predicted */
run;
proc capability data=alc2;
var resid;
qqplot;
run;
Problem 2:
A consumer product agency wants to evaluate the accuracy of determining the level of calcium in food
supplements. There are large number of possible testing labs and large number of assays. The agency
randomly picks three labs and three assays. 18 samples containing 10 mg of calcium were randomly
assigned to each assay-lab combination so that each combination had 2 samples.
assay
Lab 1
Lab2
Lab3
1
10.9, 10.9
10.5, 9.8
9.7, 10.0
2
11.3, 11.7
9.4, 10.2
8.8, 9.2
3
11.8, 11.2
10.0, 10.7
10.4, 10.7
Perform your ANOVA to check for effects for interaction, and main effects and do the necessary followups.
data lab_assay;
input a
b
unit y;
cards;
1
1
1
10.9
1
1
2
10.9
1
2
1
10.5
1
2
2
9.8
1
3
1
9.7
1
3
2
10.0
2
1
1
11.3
2
1
2
11.7
2
2
1
9.4
2
2
2
10.2
2
3
1
8.8
2
3
2
9.2
3
1
1
12.8
3
1
2
12.2
3
2
1
12.7
3
2
2
12.6
3
3
1
12.7
3
3
2
12.3
;
proc glm data=lab_assay;
class a b;
model y=a b a*b;
random a b a*b/test;
lsmeans a*b / out=out_ls;
output out=out p=py r=ry;
run;
symbol1 color="red" v="star" interpol=join;
symbol2 color="blue" v="star" interpol=join;
symbol3 color="green" v="star" interpol=join;
proc gplot data=out_ls;
/* Interaction Plot */
plot lsmean*a=b;
/* cell mean v. a by b */
plot lsmean*b=a;
/* cell mean v. b by a */
run;
goptions reset;
symbol1 color="red" v="star" interpol=none;
symbol2 color="black" v="circle" interpol=join;
proc plot data=out;
/* Diagnostic Plots */
plot y*py py*py / overlay; /* observed v. predicted */
plot ry*py;
/* residual v. predicted */
run;
proc capability data=out;
var ry;
qqplot;
run;
Download