**************************************************************** Four gasoline additives (deicers) were studied to compare their ability to prevent carburetor icing (Robert Hader and H. Lucas, personal communication). Four carburetors appropriately equipped were available. The engineers could never be sure that all of the fuel additive from one test had been cleaned off the metal surfaces in the carburetor before a second test could be performed. The Latin square, balanced for carryover effects was used. The SAS code for the analysis follows, as well as selected parts of the output. Note in particular that the carryover effects must be coded in the DATA step, rather than using the CLASS statement in PROC GLM, and are tested using a CONTRAST statement in the GLM step. The treatment, carburetor, and period effects can be set up using the coding generated by the CLASS statement. ******************************************************************; data one ; do period = 1 to 4 ; do carburetor = 1 to 4 ; input deicer $ prev_d $ y @@ ; output ; end ; end ; cards ; A N 88.0 B N 78.0 C N 87.5 D N 90.5 B A 76.0 D B 94.0 A C 95.5 C D 78.5 C B 88.0 A D 90.0 D A 95.5 B C 82.5 D C 92.0 C A 90.0 B D 87.5 A B 94.5 data two ; set one ; carryo_A = 0 ; carryo_B = 0 ; carryo_C = 0 ; if (prev_d = 'A') then carryo_A = 1 ; if (prev_d = 'B') then carryo_B = 1 ; if (prev_d = 'C') then carryo_C = 1 ; if (prev_d = 'D') then do ; carryo_A = -1 ; carryo_B = -1 ; carryo_C = -1 ; end ; ******************************************************* The code to obtain the analysis of variance is follows. *******************************************************; proc glm data = two ; class period carburetor deicer ; model y = period carburetor carryo_A carryo_B carryo_C deicer; contrast 'carryover' carryo_A 1, carryo_B 1, carryo_C 1; lsmeans deicer / stderr; estimate 'A vs B' deicer 1 -1 0 0; run; ****************************************************** Selected output ******************************************************; Source DF Sum of Square Mean Square Model 12 564.40 47.03 Error 3 21.60 7.20 Total(Corr )15 586.00 Source DF Type I SS Mean Square PERIOD 3 72.00 24.00 CARBURETOR 3 74.00 24.67 CARRYO_A 1 6.55 6.55 CARRYO_B 1 128.24 128.24 CARRYO_C 1 7.76 7.76 DEICER 3 275.85 91.95 Source DF Type III SS Mean Square F Value Pr > F PERIOD 3 72.00 24.00 3.33 0.1746 CARBURETOR 3 101.31 33.77 4.69 0.1183 CARRYO_A 1 2.13 2.13 0.30 0.6241 CARRYO_B 1 26.13 26.13 3.63 0.1529 CARRYO_C 1 2.13 2.13 0.30 0.6241 DEICER 3 275.85 91.95 12.77 0.0325 Contrast DF Contrast SS Mean Square F Value Pr > F carryover 3 42.40 14.13 1.96 0.2968 Least Squares Means DEICER Y Std Err LSMEAN LSMEAN A 91.80 1.39 B 81.70 1.39 C 86.20 1.39 D 92.30 1.39 T for H0: Pr > |T| Std Error of Parameter Estimate Parameter=0 Estimate A vs B 10.10 5.08 0.0148 1.99 ****************************************************************** The estimated means (estimated by ordinary least squares) for the four fuel additives are 91.8, 81.7, 86.2, and 92.3 for additives A-D, respectively. The standard error of the difference between two means is 1.99. The analysis of variance table is Source df Partial SS F-ratio p-value ------------------------------------------------- Carburetor 3 101.31 4.69 0.12 Period 3 72.00 3.33 0.17 Deicer 3 275.85 12.77 0.03 Carryover 3 42.40 1.96 0.30 Error 3 21.60 Notice that the sequential and partial sums of squares for periods coincide, because periods are orthogonal to all other factors in the model. In contrast, the sequential sums of squares differ from the partial sums of squares for all other factors (except the deicing treatment, Why?). *******************************************************************;