HW 9 Solutions 1a) Source DF Type III SS Mean Square F Value Pr > F trt 3 145.350000 48.450000 5.10 0.0166 There is evidence of a difference among the treatment means. F = 5.1 df = 3,12 p-value = 0.0166 1a) The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Tukey LSMEAN trt y LSMEAN Number 1 168.600000 1 2 171.000000 2 3 168.600000 3 4 175.200000 4 Least Squares Means for effect trt Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: y i/j 1 2 3 4 1 0.6198 1.0000 0.0241 2 0.6198 0.6198 0.1911 3 1.0000 0.6198 0.0241 4 0.0241 0.1911 0.0241 Treatment 4 is significantly larger than treatment 1 (p = 0.0241). Treatment 4 is significantly larger than treatment 3 (p = 0.0241). All other treatment pairs are not significantly different at the 0.05 level. 1c) The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Dunnett H0:LSMean= Control trt y LSMEAN Pr > |t| 1 168.600000 2 171.000000 0.4915 3 168.600000 1.0000 4 175.200000 0.0141 Treatments 2 and 3 are not significantly different from the control treatment (p = 0.4915 and 1, respectively). Treatment 4 is significantly different from the control (p = 0.0141). 1d) The code below produces the desired test. proc glm; class block trt; model y=block trt; estimate '1 vs. others' trt 3 -1 -1 -1 / divisor=3; run; Standard Parameter Estimate Error t Value Pr > |t| 1 vs. others -3.000000 1.59094661 -1.89 0.0838 The estimated difference is -3. The standard error is 1.591. t = -1.89 with 12 df. p-value = 0.0838 There is evidence of a significant difference at 0.1 level, but not at the 0.05 level. By hand Difference: 168.6 – (171 + 168.6 + 175.2)/3 = -3 Standard error: sqrt(MSE*sum(k(i)^2)/r) = sqrt(9.491667*[1+(-1/3)^2+(-1/3)^2+(-1/3)^2]/5) = 1.591 t-stat: -3/1.591 = -1.89 1e) All these tests can be written as constrasts with coefficients that are either 1 or -1. Thus the standard error for each contrast is SE = sqrt(9.491667*(4*1^2)/5) = 2.756 Test for fertilizer main effects contrast: (168.6 + 171) – (168.6 + 175.2) = -4.2 t-stat: -4.2/2.756 = -1.524 df = 12 F-stat: -1.524^2 = 2.323 df = 1,12 p-value: 0.1534 There is no evidence of a fertilizer main effect. Test for variety main effects contrast: 168.6 – 171 + 168.6 - 175.2 = -9 t-stat: -9/2.756 = -3.266 df = 12 F-stat: -3.266^2 = 10.667 df = 1,12 p-value: 0.0068 There is significant evidence of a variety main effect. Test for interaction between two factors contrast: 168.6 - 171 – 168.6 + 175.2 = 4.2 t-stat: 4.2/2.756 = 1.524 df = 12 F-stat: 1.524^2 = 2.323 df = 1,12 p-value: 0.1534 There is no evidence of an interaction. The code below uses the current model with appropriate contrast statements. proc glm; class block trt; model y=block trt; contrast 'fert' trt 1 1 -1 -1; contrast 'variety' trt 1 -1 1 -1; contrast 'fert*var' trt 1 -1 -1 1; run; Contrast DF Contrast SS Mean Square F Value Pr > F fert 1 22.0500000 22.0500000 2.32 0.1534 variety 1 101.2500000 101.2500000 10.67 0.0068 fert*var 1 22.0500000 22.0500000 2.32 0.1534 The SAS code below creates the data set needed to analyze the data with proc glm. data one; set one; if trt=1 then do; fert=1; variety=1; end; if trt=2 then do; fert=1; variety=2; end; if trt=3 then do; fert=2; variety=1; end; if trt=4 then do; fert=2; variety=2; end; run; proc glm; class block fert variety; model y=block fert variety fert*variety; run; Source DF Type III SS Mean Square F Value Pr > F block 4 1219.300000 304.825000 32.12 <.0001 fert 1 22.050000 22.050000 2.32 0.1534 variety 1 101.250000 101.250000 10.67 0.0068 fert*var 1 22.050000 22.050000 2.32 0.1534 2a) B C A C A B A B C 2b) row mean trt mean 4 5 9 6 A 9 7 6 7.33 2 7 3 4 B 4 3 3 3.33 6 3 0 3 C 5 2 0 2.33 col mean 4 5 4 overall mean 4.33 row SS = 3*[(6-4.33)^2 + (4-4.33)^2 + (3-4.33)^2 ] = 14 col SS = 3*[(4-4.33)^2 + (5-4.33)^2 + (4-4.33)^2 ] = 2 trt SS = 3*[(7.33-4.33)^2 + (3.33-4.33)^2 + (2.33-4.33)^2] = 42 err SS = (4 – 6 – 4 – 3.33 + 2*4.33)^2 + ... + (0 – 3 – 4 – 2.33 + 2*4.33)^2 = 0.44 + 0.11 + 0.11 + 0.11 + 0.44 + 0.11 + 0.11 + 0.11 + 0.44 = 2 The following code will calculate the results in SAS. data one; input row col trt \$ y; cards; 1 1 B 4 1 2 C 5 1 3 A 9 2 1 C 2 2 2 A 7 2 3 B 3 3 1 A 6 3 2 B 3 3 3 C 0 ; proc glm; class row col trt; model y=row col trt; run; ANOVA table: Sum of Source DF Squares Mean Square Model 6 3*(3-1) 58 9.67 Error 2 (3-1)*(3-2) 2 1 Corrected Total 8 (3^2)-1 60 The Model line can be partitioned as Sum of Source DF Squares Mean Square row 2 3-1 14 7 col 2 3-1 2 1 trt 2 3-1 42 21 2c) F = 21/1 = 21 df = 2,2 p = 0.0455 There is significant evidence of differences among treatment means. The SAS code above resulted in Source DF Type III SS Mean Square F Value Pr > F trt 2 42.00000000 21.00000000 21.00 0.0455 2d) Difference: 7.33 – 3.33 = 4 Standard error: sqrt(1*[1^2+(-1)^2]/3)= 0.816 t(0.025,2) = 4.303 95% CI: 4 +/- 4.303(0.816) = (0.489,7.513) The SAS code below provides the 95% CI. proc glm; class row col trt; model y=row col trt; lsmeans trt / pdiff cl; run; Least Squares Means for Effect trt Difference Between 95% Confidence Limits for i j Means LSMean(i)-LSMean(j) 1 2 4.000000 0.486899 7.513101 3) The following SAS output is needed to answers the questions. Sum of Source DF Squares Mean Square F Value Pr > F Model 15 22236.96958 1482.46464 16.42 0.0002 Error 8 722.14000 90.26750 Corrected Total 23 22959.10958 Source DF Type III SS Mean Square F Value Pr > F university 3 9277.671250 3092.557083 34.26 <.0001 chamber(univ) 4 7162.905000 1790.726250 19.84 0.0003 trt 2 4658.965833 2329.482917 25.81 0.0003 university*trt 6 1137.427500 189.571250 2.10 0.1635 Source Type III Expected Mean Square university Var(Error) + 2 Var(university*trt) + 3 Var(chamber(university)) + 6 Var(university) chamber(university) Var(Error) + 3 Var(chamber(university)) trt Var(Error) + 2 Var(university*trt) + Q(trt) university*trt Var(Error) + 2 Var(university*trt) 3a) F = MS(trt)/MS(univ*trt) = 2329.483/189.571 = 12.288 df = 2,6 p = 0.0076 There is significant evidence of differences among treatments. 3b) The variance component corresponding with the variability among the effects associated with trays of plants within growth chambers is the MSE = 90.268. 3c) The variance component corresponding to the variability of growth chamber effects within universities is Var(chamber(univ)). Var(chamber(univ)) = (MS(chamber(univ)) – MSE)/3 = (1790.726 – 90.268)/3 = 566.82 3d) The variance component corresponding to the variation among universities effects is Var(univ). Var(univ) = (MS(univ) – MS(chamber(univ)) – MS(univ*trt) + MSE)/6 = (3092.557 – 1790.726 – 189.571 + 90.268)/6 = 200.421 3e) Yes. The variation in the vertical direction for university 1 is much larger than for the other universities. The model that we used for analysis assumes that the variation should be the same at all universities. Note, the variation in the horizontal direction is not a concern.