options linesize = 80 ; footnote "~john-c/5421/crossover.cochran,sas &sysdate &systime" ; data machines ; length machine $1 ; retain obsnum 0 ; input trial machine time ; obsnum = obsnum + 1 ; row = 1 + mod(obsnum, 2) ; datalines ; 1 A 30 1 B 14 2 B 21 2 A 21 3 A 22 3 B 5 4 B 13 4 A 22 5 B 13 5 A 18 6 A 29 6 B 17 7 B 7 7 A 16 8 A 12 8 B 14 9 A 23 9 B 8 10 B 24 10 A 23 ; run ; data paired ; length machine1 machine2 $1 sequence $2 ; input trial1 machine1 time1 trial2 machine2 time2 ; if machine1 eq 'A' then sequence = 'AB' ; if machine1 eq 'B' then sequence = 'BA' ; diff = time1 - time2 ; datalines ; 1 A 30 1 B 14 2 B 21 2 A 21 3 A 22 3 B 5 4 B 13 4 A 22 5 B 13 5 A 18 6 A 29 6 B 17 7 B 7 7 A 16 8 A 12 8 B 14 9 A 23 9 B 8 10 B 24 10 A 23 ; run ; proc glm data = machines ; class machine trial row ; model time = machine trial row / solution ; * repeated trial ; title1 'PROC GLM Analysis of Crossover Data,' ; title2 'Cochran-Cox, Table 4.10, p. 130' ; run ; proc ttest data = paired ; class sequence ; var diff ; title1 'PROC TTEST Analysis of Crossover Data' ; title2 'Cochran-Cox, Table 4.10, p. 130' ; run ; ================================================================================== PROC GLM Analysis of Crossover Data, 1 Cochran-Cox, Table 4.10, p. 130 17:28 Wednesday, April 20, 2011 The GLM Procedure Class Level Information Class Levels Values machine 2 A B trial 10 1 2 3 4 5 6 7 8 9 10 row 2 1 2 Number of observations 20 PROC GLM Analysis of Crossover Data, 2 Cochran-Cox, Table 4.10, p. 130 17:28 Wednesday, April 20, 2011 The GLM Procedure Dependent Variable: time Sum of Source DF Squares Mean Square F Value Pr > F Model 11 742.6000000 67.5090909 3.21 0.0543 Error 8 168.2000000 21.0250000 Corrected Total 19 910.8000000 R-Square Coeff Var Root MSE time Mean 0.815327 26.05286 4.585303 17.60000 Source DF Type I SS Mean Square F Value Pr > F machine 1 320.0000000 320.0000000 15.22 0.0045 trial 9 357.8000000 39.7555556 1.89 0.1911 row 1 64.8000000 64.8000000 3.08 0.1172 Source DF Type III SS Mean Square F Value Pr > F machine 1 320.0000000 320.0000000 15.22 0.0045 trial 9 357.8000000 39.7555556 1.89 0.1911 row 1 64.8000000 64.8000000 3.08 0.1172 Standard Parameter Estimate Error t Value Pr > |t| Intercept 21.30000000 B 3.55176013 6.00 0.0003 machine A 8.00000000 B 2.05060967 3.90 0.0045 machine B 0.00000000 B . . . trial 1 -1.50000000 B 4.58530261 -0.33 0.7520 trial 2 -2.50000000 B 4.58530261 -0.55 0.6005 trial 3 -10.00000000 B 4.58530261 -2.18 0.0608 trial 4 -6.00000000 B 4.58530261 -1.31 0.2270 trial 5 -8.00000000 B 4.58530261 -1.74 0.1192 trial 6 -0.50000000 B 4.58530261 -0.11 0.9159 trial 7 -12.00000000 B 4.58530261 -2.62 0.0308 trial 8 -10.50000000 B 4.58530261 -2.29 0.0513 trial 9 -8.00000000 B 4.58530261 -1.74 0.1192 trial 10 0.00000000 B . . . row 1 -3.60000000 B 2.05060967 -1.76 0.1172 row 2 0.00000000 B . . . PROC GLM Analysis of Crossover Data, 3 Cochran-Cox, Table 4.10, p. 130 17:28 Wednesday, April 20, 2011 The GLM Procedure Dependent Variable: time NOTE: The X'X matrix has been found to be singular, and a generalized inverse was used to solve the normal equations. Terms whose estimates are followed by the letter 'B' are not uniquely estimable. PROC TTEST Analysis of Crossover Data 4 Cochran-Cox, Table 4.10, p. 130 17:28 Wednesday, April 20, 2011 The TTEST Procedure Statistics Lower CL Upper CL Lower CL Variable sequence N Mean Mean Mean Std Dev Std Dev diff AB 5 1.8785 11.6 21.322 4.6909 7.8294 diff BA 5 -10.33 -4.4 1.5289 2.8608 4.7749 diff Diff (1-2) 6.5426 16 25.457 4.3801 6.4846 Statistics Upper CL Variable sequence Std Dev Std Err Minimum Maximum diff AB 22.498 3.5014 -2 17 diff BA 13.721 2.1354 -9 1 diff Diff (1-2) 12.423 4.1012 T-Tests Variable Method Variances DF t Value Pr > |t| diff Pooled Equal 8 3.90 0.0045 diff Satterthwaite Unequal 6.61 3.90 0.0066 Equality of Variances Variable Method Num DF Den DF F Value Pr > F diff Folded F 4 4 2.69 0.3613