/* cotton.sas */ /* cotton strength example from Cochran and Cox */ options ls=72 ps=60; data cotton; infile 'cotton.dat'; input potash block strength; proc print data=cotton; title 'cotton strength data'; proc glm data=cotton; class potash block; model strength = potash block / clparm ss1 ss2; estimate 'linear' potash -13 -8 -3 7 17 / divisor = 116; estimate 'quadratic' potash 127 -20 -109 -113 115 / divisor = 1876; contrast 'linear' potash -13 -8 -3 7 17; contrast 'dev from linear' potash 4.37931 -.68966 -3.75862 -3.89655 3.96552, potash -5.19403 5.73134 4.83582 -8.41791 3.04478, potash 2.25564 -7.21805 6.76692 -2.25564 .45113; means potash block; title 'cotton strength example'; /* alternate approach to the ANOVA decomposition */ proc glm data=cotton; class potash block; model strength = potash block potash*block / ss1 ss2; means potash block potash*block; title 'alternate ANOVA decomposition'; /* input values and find orthogonal polynomial contrast coefficients */ data ortho; input x0 x1 x2 x3 x4; cards; 1 1 1 1 1 1 2 4 8 16 1 3 9 27 81 1 5 25 125 625 1 7 49 343 2401 ; proc reg data=ortho; model x1 = x0 / noint noprint; output out=ortho1 r=linear; model x2 = x0 x1 / noint noprint; output out=ortho2 r=quad; model x3 = x0 x1 x2 / noint noprint; output out=ortho3 r=cubic; model x4 = x0 x1 x2 x3 / noint noprint; output out=ortho4 r=quartic; title 'orthogonal polynomial contrasts'; data orthoc; merge ortho1 ortho2 ortho3 ortho4; proc print data=orthoc; var x0 linear quad cubic quartic; run;