/****************************************************/
/* scab1.sas **************************************/
/****************************************************/
options nodate pageno=1;
ods graphics on;
ods listing gpath="c:\temp";
ods pdf file="C:\Users\danhall\Documents\DansWorkStuff\courses\STAT 8200\Fall13\scab1.pdf";
data scab;
input trt $ scabindx;
cards;
0 10
0 12
0 18
0 30
0 32
0 24
0 29
0 26
F3 9
F3 9
F3 16
F3 4
F6 18
F6 10
F6 18
F6 16
F12 4
F12 10
F12 5
F12 4
S3 9
S3 7
S3 21
S3 30
S6 18
S6 19
S6 24
S6 12
S12 7
S12 17
S12 17
S12 16
;
run;
title 'Scab Disease Data';
proc print data=scab;
run;
title 'One-way Anova for Scab Disease Data';
proc glm data=scab order=data;
class trt;
model scabindx=trt;
/* The following three contrasts are just for illustration, there's not any
obvious motivation for making a comparison between mu2 and mu3 here */
contrast 'mu2-mu3 (a)' intercept 0 trt 0 1 -1 0 0 0 0;
contrast 'mu2-mu3 (b)' trt 0 1 -1 0 0 0 0;
contrast 'mu2-mu3 (c)' trt 0 1 -1;
/* The following four contrasts are the planned comparisons */
contrast 'control vs. trt' trt 6 -1 -1 -1 -1 -1 -1;
contrast 'season ' trt 0 1 1 1 -1 -1 -1;
contrast 'dose ' trt 0 2 -1 -1 2 -1 -1,
trt 0 0 -1 1 0 -1 1;
contrast 'season x dose ' trt 0 2 -1 -1 -2 1 1,
trt 0 0 -1 1 0 1 -1;
/* The following estimate statement estimates mu1- (1/6)*(mu2+...+mu7)
which is the difference between the control treatment and the average of
the treatments in which sulphur was applied. The /divisor=6 option here is
important. Without it, we'd be estimating 6*mu1- (mu2+...+mu7), which
is not really what we're interested in. Note that in the CONTRAST
the divisor option is not available. Why? Because the hypotheses
mu1- (1/6)*(mu2+...+mu7)=0 and 6*mu1- (mu2+...+mu7)=0 are equivalent
(multiplying by a constant doesn't change the hypothesis) */
estimate 'control-trt' trt 6 -1 -1 -1 -1 -1 -1/divisor=6;
*The LSMEANS statement below gives estimated treatment means.
Note that there are options available on the LSMEANS statement
to generate pairwise comparisons between treatment means which
could also be done using CONTRAST or ESTIMATE. We will illustrate
these options later in the course.;
lsmeans trt/stderr cl; * the options ask for SEs and 95% CIs for each mean;
run;
ods pdf close;