/* potato.sas */ /* Potato leafhopper example */ data potato; input treat $ time; treat2 = treat; if treat = 'fructose' or treat = 'glucose' then treat2 = 'sixcarb'; treat3 = treat2; if treat2 = 'sucrose' or treat2 = 'sixcarb' then treat3 = 'sugar'; cards; control 2.3 control 1.7 sucrose 3.6 sucrose 4.0 glucose 3.0 glucose 2.8 fructose 2.1 fructose 2.3 ; /* Print the data */ proc print data=potato; var time treat treat2 treat3; title 'potato leafhopper data'; /* --------------------------------------------------------- */ /* Fit the full model with 4 means (C,F,G,S) */ proc glm data=potato; class treat; model time = treat / clparm; contrast 'fructose vs glucose' treat 0 1 -1 0; estimate 'fructose vs glucose' treat 0 1 -1 0 / e; title 'full model with 4 means (C,F,G,S)'; /* --------------------------------------------------------- */ /* Fit the reduced model with 3 means (C,sixcarb,S) */ proc glm data=potato; class treat2; model time = treat2 / clparm; contrast '6-carbons vs sucrose' treat2 0 1 -1; estimate '6-carbons vs sucrose' treat2 0 1 -1; title 'reduced model with 3 means (C,sixcarb,S)'; /* --------------------------------------------------------- */ /* Fit the reduced model with 2 means (C,sugar) */ proc glm data=potato; class treat3; model time = treat3 / clparm; contrast 'control vs sugars' treat3 1 -1; estimate 'control vs sugars' treat3 1 -1; title 'most reduced model with 2 means (C,sugar)'; /* --------------------------------------------------------- */ /* Refit the model with 3 means and get more details */ proc glm data=potato; class treat2; model time = treat2 / clparm; contrast 'control vs sucrose' treat2 1 0 -1; contrast '6-carbons vs sucrose' treat2 0 1 -1; contrast '6-carbons vs control' treat2 -1 1 0; contrast 'sucrose vs others' treat2 -1 -1 2; estimate 'control vs sucrose' treat2 1 0 -1; estimate '6-carbons vs sucrose' treat2 0 1 -1; estimate '6-carbons vs control' treat2 -1 1 0; estimate 'sucrose vs others' treat2 -1 -1 2 / divisor=2; means treat2 / deponly scheffe cldiff; title 'detailed analysis for the model with 3 means'; /* --------------------------------------------------------- */ /* get the multiplier for the Scheffe intervals */ data scheffe; F = finv(.95,2,5); multi = sqrt(2*F); proc print data=scheffe; title 'the multiplier for the Scheffe intervals'; /* --------------------------------------------------------- */ /* use the multiplier from above and the estimates and standard errors from proc GLM to get the simultaneous 95% confidence intervals for the differences between the adjusted means */ data interval; input differ $ estimate stderr; multi = sqrt(2*finv(.95,2,5)); lowerCL = estimate - multi*stderr; upperCL = estimate + multi*stderr; cards; C_S -1.80000000 0.39749214 6_S -1.25000000 0.34423829 6_C 0.55000000 0.34423829 S_(Cand6) 1.52500000 0.32958307 ; proc print data=interval; var differ estimate stderr lowerCL upperCL; title 'simultaneous Scheffe type intervals'; run;