/**********************************************************/ /* */ /* This sas-file contains several examples of the usage */ /* of the %MULT macro. The examples were partly used in */ /* */ /* Piepho, H.P. (2004): An algorithm for a letter-based */ /* representation of all-pairwise comparisons. Journal of */ /* Computational and Graphical Statistics 13, 456-466. */ /* */ /* and */ /* */ /* Piepho, H.P. (2012): A SAS macro for generating letter */ /* displays of pairwise mean comparisons. Communications */ /* in Biometry and Crop Science XX, XX-XX. */ /* */ /**********************************************************/ /*This example concerns a trial with three soil preparation methods (SOIL) and four soil depths (DEPTH). The repeated factor DEPTH requires a mixed model with autocorrelated errors. Data were kindly provided by Fabian Wald (Institut für Pflanzenbau und Grünland, Universität Hohenheim, Germany). */ data nmin; input block depth$ soil$ Nmin; log_nmin=log(nmin); datalines; 1 1 1 39.36 1 2 1 17.49 1 3 1 6.89 1 4 1 6.54 1 1 2 44.82 1 2 2 11.75 1 3 2 5.54 1 4 2 9.49 1 1 3 6.01 1 2 3 5.08 1 3 3 2.28 1 4 3 2.04 2 1 2 43.72 2 2 2 12.63 2 3 2 4.62 2 4 2 4.33 2 1 1 45.92 2 2 1 26.49 2 3 1 8.51 2 4 1 8.65 2 1 3 7.35 2 2 3 4.92 2 3 3 2.97 2 4 3 2.71 3 1 1 34.04 3 2 1 13.80 3 3 1 5.90 3 4 1 6.00 3 1 3 4.43 3 2 3 5.06 3 3 3 2.67 3 4 3 1.86 3 1 2 31.28 3 2 2 6.43 3 3 2 2.81 3 4 2 2.93 4 1 2 32.87 4 2 2 8.96 4 3 2 4.05 4 4 2 3.69 4 1 3 4.90 4 2 3 3.06 4 3 3 2.23 4 4 3 2.36 4 1 1 43.66 4 2 1 21.06 4 3 1 8.53 4 4 1 8.69 ; %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc mixed data=nmin; ods output diffs=diffs lsmeans=lsmeans; class depth block soil; model log_nmin=block*depth depth soil soil*depth/ddfm=kr; repeated depth/sub=block*soil type=arh(1); lsmeans soil*depth/pdiff; %mult(trt=soil, by=depth); %mult(trt=depth, by=soil); run; proc mixed data=nmin; ods output diffs=diffs lsmeans=lsmeans; class depth block soil; model log_nmin=block*depth depth soil soil*depth/ddfm=kr; repeated depth/sub=block*soil type=arh(1); lsmeans soil/pdiff; %mult(trt=soil); run; /*a simulated example of a 4 factor experiment*/ data abcd; do a=1 to 3; do b=1 to 3; do c=1 to 3; do d=1 to 3; do rep=1 to 2; y=a*b*c+d+normal(1); output; end; end; end; end; end; %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc mixed data=abcd; ods output lsmeans=lsmeans diffs=diffs; class a b c d; model y=a|b|c|d; lsmeans a*b*c*d/pdiff; %mult(trt=a, by=b, by2=c, by3=d); run; proc mixed data=abcd; ods output lsmeans=lsmeans diffs=diffs; class a b c; model y=a|b|c; lsmeans a*b*c/pdiff; %mult(trt=a, by=c, by2=b); run; /*This example concerns eight morphological measurements for 159 fish caught off lake Laengelmavesi near Tampere, Finland. The data are available from the Data Archive of the Journal of Statistics Education (also see SAS Institute, 1999, p.3156). Example used in Piepho (2004)*/ data fish; title 'Fish Measurement Data'; input Species Weight Length1 Length2 Length3 HtPct WidthPct @@; Height=HtPct*Length3/100; Width=WidthPct*Length3/100; n_dum=1; htpct=htpct/100; widthpct=widthpct/100; datalines; 1 242.0 23.2 25.4 30.0 38.4 13.4 1 290.0 24.0 26.3 31.2 40.0 13.8 1 340.0 23.9 26.5 31.1 39.8 15.1 1 363.0 26.3 29.0 33.5 38.0 13.3 1 430.0 26.5 29.0 34.0 36.6 15.1 1 450.0 26.8 29.7 34.7 39.2 14.2 1 500.0 26.8 29.7 34.5 41.1 15.3 1 390.0 27.6 30.0 35.0 36.2 13.4 1 450.0 27.6 30.0 35.1 39.9 13.8 1 500.0 28.5 30.7 36.2 39.3 13.7 1 475.0 28.4 31.0 36.2 39.4 14.1 1 500.0 28.7 31.0 36.2 39.7 13.3 1 500.0 29.1 31.5 36.4 37.8 12.0 1 . 29.5 32.0 37.3 37.3 13.6 1 600.0 29.4 32.0 37.2 40.2 13.9 1 600.0 29.4 32.0 37.2 41.5 15.0 1 700.0 30.4 33.0 38.3 38.8 13.8 1 700.0 30.4 33.0 38.5 38.8 13.5 1 610.0 30.9 33.5 38.6 40.5 13.3 1 650.0 31.0 33.5 38.7 37.4 14.8 1 575.0 31.3 34.0 39.5 38.3 14.1 1 685.0 31.4 34.0 39.2 40.8 13.7 1 620.0 31.5 34.5 39.7 39.1 13.3 1 680.0 31.8 35.0 40.6 38.1 15.1 1 700.0 31.9 35.0 40.5 40.1 13.8 1 725.0 31.8 35.0 40.9 40.0 14.8 1 720.0 32.0 35.0 40.6 40.3 15.0 1 714.0 32.7 36.0 41.5 39.8 14.1 1 850.0 32.8 36.0 41.6 40.6 14.9 1 1000.0 33.5 37.0 42.6 44.5 15.5 1 920.0 35.0 38.5 44.1 40.9 14.3 1 955.0 35.0 38.5 44.0 41.1 14.3 1 925.0 36.2 39.5 45.3 41.4 14.9 1 975.0 37.4 41.0 45.9 40.6 14.7 1 950.0 38.0 41.0 46.5 37.9 13.7 2 40.0 12.9 14.1 16.2 25.6 14.0 2 69.0 16.5 18.2 20.3 26.1 13.9 2 78.0 17.5 18.8 21.2 26.3 13.7 2 87.0 18.2 19.8 22.2 25.3 14.3 2 120.0 18.6 20.0 22.2 28.0 16.1 2 0.0 19.0 20.5 22.8 28.4 14.7 2 110.0 19.1 20.8 23.1 26.7 14.7 2 120.0 19.4 21.0 23.7 25.8 13.9 2 150.0 20.4 22.0 24.7 23.5 15.2 2 145.0 20.5 22.0 24.3 27.3 14.6 2 160.0 20.5 22.5 25.3 27.8 15.1 2 140.0 21.0 22.5 25.0 26.2 13.3 2 160.0 21.1 22.5 25.0 25.6 15.2 2 169.0 22.0 24.0 27.2 27.7 14.1 2 161.0 22.0 23.4 26.7 25.9 13.6 2 200.0 22.1 23.5 26.8 27.6 15.4 2 180.0 23.6 25.2 27.9 25.4 14.0 2 290.0 24.0 26.0 29.2 30.4 15.4 2 272.0 25.0 27.0 30.6 28.0 15.6 2 390.0 29.5 31.7 35.0 27.1 15.3 3 270.0 23.6 26.0 28.7 29.2 14.8 3 270.0 24.1 26.5 29.3 27.8 14.5 3 306.0 25.6 28.0 30.8 28.5 15.2 3 540.0 28.5 31.0 34.0 31.6 19.3 3 800.0 33.7 36.4 39.6 29.7 16.6 3 1000.0 37.3 40.0 43.5 28.4 15.0 4 55.0 13.5 14.7 16.5 41.5 14.1 4 60.0 14.3 15.5 17.4 37.8 13.3 4 90.0 16.3 17.7 19.8 37.4 13.5 4 120.0 17.5 19.0 21.3 39.4 13.7 4 150.0 18.4 20.0 22.4 39.7 14.7 4 140.0 19.0 20.7 23.2 36.8 14.2 4 170.0 19.0 20.7 23.2 40.5 14.7 4 145.0 19.8 21.5 24.1 40.4 13.1 4 200.0 21.2 23.0 25.8 40.1 14.2 4 273.0 23.0 25.0 28.0 39.6 14.8 4 300.0 24.0 26.0 29.0 39.2 14.6 5 5.9 7.5 8.4 8.8 24.0 16.0 5 32.0 12.5 13.7 14.7 24.0 13.6 5 40.0 13.8 15.0 16.0 23.9 15.2 5 51.5 15.0 16.2 17.2 26.7 15.3 5 70.0 15.7 17.4 18.5 24.8 15.9 5 100.0 16.2 18.0 19.2 27.2 17.3 5 78.0 16.8 18.7 19.4 26.8 16.1 5 80.0 17.2 19.0 20.2 27.9 15.1 5 85.0 17.8 19.6 20.8 24.7 14.6 5 85.0 18.2 20.0 21.0 24.2 13.2 5 110.0 19.0 21.0 22.5 25.3 15.8 5 115.0 19.0 21.0 22.5 26.3 14.7 5 125.0 19.0 21.0 22.5 25.3 16.3 5 130.0 19.3 21.3 22.8 28.0 15.5 5 120.0 20.0 22.0 23.5 26.0 14.5 5 120.0 20.0 22.0 23.5 24.0 15.0 5 130.0 20.0 22.0 23.5 26.0 15.0 5 135.0 20.0 22.0 23.5 25.0 15.0 5 110.0 20.0 22.0 23.5 23.5 17.0 5 130.0 20.5 22.5 24.0 24.4 15.1 5 150.0 20.5 22.5 24.0 28.3 15.1 5 145.0 20.7 22.7 24.2 24.6 15.0 5 150.0 21.0 23.0 24.5 21.3 14.8 5 170.0 21.5 23.5 25.0 25.1 14.9 5 225.0 22.0 24.0 25.5 28.6 14.6 5 145.0 22.0 24.0 25.5 25.0 15.0 5 188.0 22.6 24.6 26.2 25.7 15.9 5 180.0 23.0 25.0 26.5 24.3 13.9 5 197.0 23.5 25.6 27.0 24.3 15.7 5 218.0 25.0 26.5 28.0 25.6 14.8 5 300.0 25.2 27.3 28.7 29.0 17.9 5 260.0 25.4 27.5 28.9 24.8 15.0 5 265.0 25.4 27.5 28.9 24.4 15.0 5 250.0 25.4 27.5 28.9 25.2 15.8 5 250.0 25.9 28.0 29.4 26.6 14.3 5 300.0 26.9 28.7 30.1 25.2 15.4 5 320.0 27.8 30.0 31.6 24.1 15.1 5 514.0 30.5 32.8 34.0 29.5 17.7 5 556.0 32.0 34.5 36.5 28.1 17.5 5 840.0 32.5 35.0 37.3 30.8 20.9 5 685.0 34.0 36.5 39.0 27.9 17.6 5 700.0 34.0 36.0 38.3 27.7 17.6 5 700.0 34.5 37.0 39.4 27.5 15.9 5 690.0 34.6 37.0 39.3 26.9 16.2 5 900.0 36.5 39.0 41.4 26.9 18.1 5 650.0 36.5 39.0 41.4 26.9 14.5 5 820.0 36.6 39.0 41.3 30.1 17.8 5 850.0 36.9 40.0 42.3 28.2 16.8 5 900.0 37.0 40.0 42.5 27.6 17.0 5 1015.0 37.0 40.0 42.4 29.2 17.6 5 820.0 37.1 40.0 42.5 26.2 15.6 5 1100.0 39.0 42.0 44.6 28.7 15.4 5 1000.0 39.8 43.0 45.2 26.4 16.1 5 1100.0 40.1 43.0 45.5 27.5 16.3 5 1000.0 40.2 43.5 46.0 27.4 17.7 5 1000.0 41.1 44.0 46.6 26.8 16.3 6 200.0 30.0 32.3 34.8 16.0 9.7 6 300.0 31.7 34.0 37.8 15.1 11.0 6 300.0 32.7 35.0 38.8 15.3 11.3 6 300.0 34.8 37.3 39.8 15.8 10.1 6 430.0 35.5 38.0 40.5 18.0 11.3 6 345.0 36.0 38.5 41.0 15.6 9.7 6 456.0 40.0 42.5 45.5 16.0 9.5 6 510.0 40.0 42.5 45.5 15.0 9.8 6 540.0 40.1 43.0 45.8 17.0 11.2 6 500.0 42.0 45.0 48.0 14.5 10.2 6 567.0 43.2 46.0 48.7 16.0 10.0 6 770.0 44.8 48.0 51.2 15.0 10.5 6 950.0 48.3 51.7 55.1 16.2 11.2 6 1250.0 52.0 56.0 59.7 17.9 11.7 6 1600.0 56.0 60.0 64.0 15.0 9.6 6 1550.0 56.0 60.0 64.0 15.0 9.6 6 1650.0 59.0 63.4 68.0 15.9 11.0 7 6.7 9.3 9.8 10.8 16.1 9.7 7 7.5 10.0 10.5 11.6 17.0 10.0 7 7.0 10.1 10.6 11.6 14.9 9.9 7 9.7 10.4 11.0 12.0 18.3 11.5 7 9.8 10.7 11.2 12.4 16.8 10.3 7 8.7 10.8 11.3 12.6 15.7 10.2 7 10.0 11.3 11.8 13.1 16.9 9.8 7 9.9 11.3 11.8 13.1 16.9 8.9 7 9.8 11.4 12.0 13.2 16.7 8.7 7 12.2 11.5 12.2 13.4 15.6 10.4 7 13.4 11.7 12.4 13.5 18.0 9.4 7 12.2 12.1 13.0 13.8 16.5 9.1 7 19.7 13.2 14.3 15.2 18.9 13.6 7 19.9 13.8 15.0 16.2 18.1 11.6 ; %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc mixed data=fish; ods output diffs=diffs lsmeans=lsmeans; class species; model weight=species; lsmeans species/pdiff adjust=sim(nsamp=100000); repeated/group=species; %mult(trt=species, alpha=0.05, p=adjp); run; %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc genmod data=fish; ods output diffs=diffs lsmeans=lsmeans; class species; model widthPct/n_dum=species/dist=bin link=logit scale=pearson; lsmeans species/diff; %mult(trt=species, alpha=0.05/21, p=probz); run; /*data from Steel & Torrie, 1980 Principles and procedures of statistics. A biometrical approach. McGraw Hill, NY, p.412. Example used in Piepho (2012)*/ data lima; input block variety x y; datalines; 1 1 34.0 93.0 2 1 33.4 94.8 3 1 34.7 91.7 4 1 38.9 80.8 5 1 36.1 80.2 1 2 39.6 47.3 2 2 39.8 51.5 3 2 51.2 33.3 4 2 52.0 27.2 5 2 56.2 20.6 1 3 31.7 81.4 2 3 30.1 109.0 3 3 33.8 71.6 4 3 39.6 57.5 5 3 47.8 30.1 1 4 37.7 66.9 2 4 38.2 74.1 3 4 40.3 64.7 4 4 39.4 69.3 5 4 41.3 63.2 1 5 24.9 119.5 2 5 24.0 128.5 3 5 24.9 125.6 4 5 23.5 129.0 5 5 25.1 126.2 1 6 30.3 106.6 2 6 29.1 111.4 3 6 31.7 99.0 4 6 28.3 126.1 5 6 34.2 95.6 1 7 32.7 106.1 2 7 33.8 107.2 3 7 34.8 97.5 4 7 35.4 86.0 5 7 37.8 88.8 1 8 34.5 61.5 2 8 31.5 83.4 3 8 31.1 93.9 4 8 36.1 69.0 5 8 38.5 46.9 1 9 31.4 80.5 2 9 30.5 106.5 3 9 34.6 76.7 4 9 30.9 91.8 5 9 36.8 68.2 1 10 21.2 149.2 2 10 25.3 151.6 3 10 23.5 170.1 4 10 24.8 155.2 5 10 24.6 146.1 1 11 30.8 78.7 2 11 26.4 116.9 3 11 33.2 71.8 4 11 33.5 70.3 5 11 43.8 40.9 ; /*The macro works with both GLIMMIX and MIXED*/ %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc glimmix data=lima; ods output lsmeans=lsmeans diffs=diffs; class block variety; model y=x block variety; lsmeans variety/pdiff; %mult(trt=variety); run; /*Split plot experiment with oats, Steel & Torrie 1980, p.384 Example used in Piepho (2012)*/ data oats; input seed_lot$9. block y1-y4; seed_treatment='Check '; yield=y1; output; seed_treatment='CeresanM'; yield=y2; output; seed_treatment='Panogen '; yield=y3; output; seed_treatment='Agrox '; yield=y4; output; datalines; Vicaland1 1 42.9 53.8 49.5 44.4 Vicaland1 2 41.6 58.5 53.8 41.8 Vicaland1 3 28.9 43.9 40.7 28.3 Vicaland1 4 30.8 46.3 39.4 34.7 Vicaland2 1 53.3 57.6 59.8 64.1 Vicaland2 2 69.6 69.6 65.8 57.4 Vicaland2 3 45.4 42.4 41.4 44.1 Vicaland2 4 35.1 51.9 45.4 51.6 Clinton 1 62.3 63.4 64.5 63.6 Clinton 2 58.5 50.4 46.1 56.1 Clinton 3 44.6 45.0 62.6 52.7 Clinton 4 50.3 46.7 50.3 51.8 Branch 1 75.4 70.3 68.8 71.6 Branch 2 65.6 67.3 65.3 69.4 Branch 3 54.0 57.6 45.6 56.6 Branch 4 52.7 58.5 51.0 47.4 ; proc glimmix data=oats; class block seed_treatment seed_lot; model yield=block seed_treatment|seed_lot; random block*seed_lot; slice seed_lot*seed_treatment/sliceby=seed_treatment lines; slice seed_lot*seed_Treatment/sliceby=seed_treatment lines; run; %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc glimmix data=oats; ods output lsmeans=lsmeans diffs=diffs; class block seed_treatment seed_lot; model yield=block seed_treatment|seed_lot; random block*seed_lot; lsmeans seed_treatment*seed_lot/pdiff; %mult(trt=seed_lot, by=seed_treatment); %mult(trt=seed_treatment, by=seed_lot); run; /*Lettuce trial LD8 taken from Simko & Piepho 2012 Phytopathology. Example used in Piepho (2012)*/ data LD8; array y y1-y8; input treatment$ y0-y8; plot=_N_; do time=1 to 8; response=y[time]; output; end; datalines; T-01 0 0 29.41176471 76.47058824 88.23529412 88.23529412 94.11764706 100 100 T-01 0 6.25 12.5 37.5 81.25 87.5 87.5 87.5 93.75 T-01 0 5.882352941 17.64705882 52.94117647 88.23529412 88.23529412 88.23529412 94.11764706 100 T-01 0 11.11111111 11.11111111 27.77777778 77.77777778 77.77777778 83.33333333 94.44444444 100 T-01 0 0 0 50 81.25 87.5 93.75 93.75 100 T-01 0 0 0 25 68.75 81.25 93.75 100 100 T-01 0 0 0 5.882352941 52.94117647 82.35294118 88.23529412 94.11764706 100 T-02 0 0 6.25 18.75 56.25 62.5 62.5 62.5 68.75 T-02 0 0 6.25 18.75 50 50 56.25 62.5 68.75 T-02 0 6.25 12.5 62.5 62.5 62.5 62.5 62.5 62.5 T-02 0 0 0 37.5 81.25 81.25 81.25 87.5 87.5 T-02 0 6.25 6.25 43.75 43.75 43.75 43.75 43.75 43.75 T-02 0 6.25 6.25 43.75 43.75 43.75 43.75 43.75 43.75 T-02 0 0 6.25 37.5 37.5 37.5 37.5 37.5 37.5 T-15 0 5.882352941 17.64705882 29.41176471 58.82352941 76.47058824 88.23529412 94.11764706 100 T-15 0 0 0 43.75 87.5 93.75 93.75 93.75 100 T-15 0 12.5 25 43.75 81.25 81.25 87.5 87.5 87.5 T-15 0 5.882352941 5.882352941 41.17647059 70.58823529 82.35294118 88.23529412 94.11764706 100 T-15 0 12.5 18.75 62.5 87.5 93.75 93.75 93.75 100 T-15 0 0 0 18.75 56.25 75 93.75 93.75 100 T-15 0 12.5 31.25 43.75 75 81.25 93.75 93.75 100 T-16 0 0 18.75 62.5 87.5 87.5 100 100 100 T-16 0 0 12.5 43.75 93.75 93.75 100 100 100 T-16 6.25 6.25 18.75 31.25 87.5 93.75 93.75 93.75 100 T-16 0 4.545454545 9.090909091 45.45454545 86.36363636 90.90909091 100 100 100 T-16 0 12.5 25 56.25 81.25 87.5 93.75 100 100 T-16 0 0 6.25 12.5 37.5 50 56.25 62.5 68.75 T-16 0 0 18.75 25 68.75 75 93.75 93.75 93.75 ; proc glimmix data=LD8 lognote; class treatment time plot; model response=treatment|time/ddfm=KR; random time/subject=plot type=unr residual; slice treatment*time/sliceby=treatment lines; run; %include 'd:\hpp\veroeff\12\mult\mult.sas'; proc glimmix data=LD8 lognote; ods output lsmeans=lsmeans diffs=diffs; class treatment time plot; model response=treatment|time/ddfm=KR; random time/subject=plot type=unr residual; lsmeans treatment*time/pdiff; %mult(trt=time, by=treatment); run;