Download Three-Factor ANOVA, Example 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
STA 6167, Three-Factor Experiment, Example 1
A marketing research consultant evaluated the effects of fee schedule (Factor A), scope of work
(Factor B), and type of supervisory control (Factor C) on the quality of work performed under contract
by independent marketing research agencies. The quality of work performed was measured by an
index taking into account several characteristics of quality. Four agencies were chosen for each factor
level combination and the quality of their work was evaluated. (Example on p. 1023 of KNNL.)
The SAS program below includes all relevant means, interaction plots, appropriate tests for
effects, a residual plot, and a normal probability plot.
proc format;
value feefmt 1 = "High
"
2 = "Average"
3 = "Low
";
value scpfmt 1 = "All in house
"
2 = "Some subcontracted";
value supfmt 1 = "Local Supers
"
2 = "Traveling Supers";
data one;
input y a b c obs;
label y = "Work Quality"
a = "Fee Schedule"
b = "Scope of Work"
c = "Type of Supervision";
if a = 1 and b = 1 and c = 1 then abc = 1;
else if a = 1 and b = 1 and c = 2 then abc
else if a = 1 and b = 2 and c = 1 then abc
else if a = 1 and b = 2 and c = 2 then abc
else if a = 2 and b = 1 and c = 1 then abc
else if a = 2 and b = 1 and c = 2 then abc
else if a = 2 and b = 2 and c = 1 then abc
else if a = 2 and b = 2 and c = 2 then abc
else if a = 3 and b = 1 and c = 1 then abc
else if a = 3 and b = 1 and c = 2 then abc
else if a = 3 and b = 2 and c = 1 then abc
else if a = 3 and b = 2 and c = 2 then abc
format a feefmt. b scpfmt. c supfmt.;
cards;
124.3
1
1
1
1
120.6
1
1
1
2
120.7
1
1
1
3
122.6
1
1
1
4
112.7
1
1
2
1
110.2
1
1
2
2
113.5
1
1
2
3
108.6
1
1
2
4
115.1
1
2
1
1
119.9
1
2
1
2
115.4
1
2
1
3
117.3
1
2
1
4
88.2
1
2
2
1
96.0
1
2
2
2
96.4
1
2
2
3
90.1
1
2
2
4
119.3
2
1
1
1
118.9
2
1
1
2
125.3
2
1
1
3
121.4
2
1
1
4
=
=
=
=
=
=
=
=
=
=
=
2;
3;
4;
5;
6;
7;
8;
9;
10;
11;
12;
113.6
109.1
108.9
112.3
117.2
114.4
113.4
120.0
92.7
91.1
90.7
87.9
90.9
95.3
88.8
92.0
78.6
80.6
83.5
77.1
89.9
83.0
86.5
82.7
58.6
63.5
59.8
62.3
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
1
1
1
1
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
2
2
2
2
1
1
1
1
2
2
2
2
1
1
1
1
2
2
2
2
;
proc print;
;
data two;set one;if a=1;
;
proc sort ;by b c;
;
proc means noprint;by b c;
output out=cellmean mean=cm;
var y;
;
proc gplot data=cellmean;
plot cm*b=c;
title "Interaction Plot";
title2 "High Fees";
;
data two;set one;if a=2;
;
proc sort ;by b c;
;
proc means noprint;by b c;
output out=cellmean mean=cm;
var y;
;
proc gplot data=cellmean;
plot cm*b=c;
title "Interaction Plot";
title2 "Average Fees";
;
data two;set one;if a=3;
;
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
proc sort ;by b c;
;
proc means noprint;by b c;
output out=cellmean mean=cm;
var y;
;
proc gplot data=cellmean;
plot cm*b=c;
title "Interaction Plot";
title2 "Low Fees";
;
proc glm data=one;
class a b c;
model y = a|b|c;
output out=resids r=res;
means a|b|c;
title "Three-Factor Experiment to Compare Work Quality";
title2 "for Factors Fee Schedule, Scope of Work, and Type of Supervision";
title3 "Full Model, With Least Squares Means";
;
data two;set resids;
/* The following statement creates a dummy variable with value 1 for every */
/* observation in the data set. This variable will be used to merge the sample */
/* statistics with every observation in the original data set. */
dum = 1;
;
proc sort;by res;
;
proc means noprint;
var res;
output out=meanr mean=mu std=s n=size;
title;
title2;
;
data three;set meanr;dum = 1;
;
data three;merge two three;by dum;
p = (_n_ - 0.5)/size;
/* The following equation would need to be changed for q-q plots for other */
/* probability distributions. For example, for an exponential(mu) distribution,
*/
/* the statement would be Q = -mu*log(1-p). */
Q = probit(p);
;
proc gplot;
plot res*abc;
title "Plot of Residuals v. Treatments";
;
proc reg noprint;
model res = Q;
plot (res predicted.)*Q / overlay;
title 'Normal Probability Plot';
title2 'For Residuals from ANOVA';
;
run;
Related documents