Statistical Analysis Professor Lynne Stokes Department of Statistical Science Lecture 12 Analysis of Factor-Effects: Linear Combinations, Contrasts, Polynomials Analysis of Ballistic Limit Velocities MGH Exercise #6.6 Nose Shape Blunt Conical Hemispherical Angle 0 938 942 943 889 890 892 876 877 881 45 1162 1167 1163 1151 1145 1152 1124 1125 1128 Model and Assumptions yijk = m + ai + bj + (ab)ij + eijk where ai b j (ab)ij (ab)ij 0, yij = ballistic velocity for the kth repeat of the ith nose cone and the jth angle m = overall mean ballistic velocity ai = fixed effect of the ith nose cone on mean velocity bi = fixed effect of the jth angle on mean velocity (ab)ij = fixed effect of the interaction between the ith nose cone and the jth angle on mean velocity eij = random experimental error, NID(0,s2) Analysis of Variance Table Mason, Gunst, & Hess: Exercise 6.6 3 The ANOVA Procedure Dependent Variable: velocity DF Sum of Squares Mean Square F Value Pr > F Model 5 275139.6111 55027.9222 7861.13 <.0001 Error 12 84.0000 7.0000 Corrected Total 17 275223.6111 Source Source shape angle shape*angle R-Square Coeff Var Root MSE velocity Mean 0.999695 0.258192 2.645751 1024.722 DF Anova SS Mean Square F Value Pr > F 2 1 2 7916.4444 266206.7222 1016.4444 3958.2222 266206.7222 508.2222 565.46 38029.5 72.60 <.0001 <.0001 <.0001 Interaction Null Hypothesis H 0 : (ab)ij 0 for all i, j H a : (ab)ij 0 for some i, j The effect of differing nose cones on mean ballistic velocity is the same for all angles of launch. Test Procedure Reject H0 if F = MSAB/MSE > F0.05(2,12)=3.89 Conclusion There is sufficient evidence (p = 0.0001) to conclude at a significance level of 0.05 that the effects of nose cone design and launch angle differ on the mean ballistic velocities of 10 mm rolled armor projectiles. Interaction Averages Level of SHAPE Level of ANGLE Blunt 0 Blunt 45 Conical 0 Conical 45 Hemispherical 0 Hemispherical 45 -----------VELOCITY---------N Mean SD 3 3 3 3 3 3 941.00000 1164.00000 890.33333 1149.33333 878.00000 1125.66667 2.64575131 2.64575131 1.52752523 3.78593890 2.64575131 2.08166600 Exercise 6.6: Interaction Averages for Ballistic Limit Velocities. Average Velocity (m/sec) 1200 1100 Angle = 0 Angle = 45 Fisher’s LSD = 5.53 1000 900 Statistical vs. Practical Significance for the Interaction 800 Blunt Conic Shape Hemispheric Linear Combinations of Parameters Estimable Functions of Parameters cim i Example: m 1 m 2 2m a 1 a 2 Estimator Standard Error t Statistic ˆ ci yi seˆ s ci2 ˆ t se ˆ /r 1/ 2 Not Usually of Interest Several individual comparisons could be of interest Interest in comparing Wheelchair and crutches vs. amputee and hearing loss Contrasts of Effects Estimable Factor Effects c i m i m c i c i a i cia i ci 0 Contrasts Elimination of the overall mean requires contrasts of main effect averages. (Note: Want to compare factor effects.) Elimination of main effects from interaction comparisons requires contrasts of the interaction Aaverages. (Note: Want interaction effects to measure variability that is unaccounted for by or in addition to the main effects.) Statistical Independence y ~ N(Xb , s2I) mˆ c y 1 1 mˆ 2 c 2 y mˆ 1 and mˆ 2 are statistica lly independen t c1c2 0 Orthogonal linear combinations are statistically independent Orthogonal contrasts are statistically independent Analysis of Water Pump Prototypes Company A Design 1 Design 2 31,189 24,944 31,416 24,712 30,643 24,576 30,321 25,488 30,661 24,403 30,756 24,625 31,316 24,953 30,826 25,930 30,924 24,215 31,168 24,858 Company B Design 3 Design 4 24,356 27,077 24,036 26,030 24,544 26,573 26,233 25,804 23,075 25,906 25,264 27,190 25,667 26,539 21,613 27,724 21,752 26,384 26,135 26,712 Designs 1 & 3 are Nominally Identical Designs 2 & 4 are Nominally Identical MGH Ex 6.22 Analysis of Water Pump Prototypes Model and Assumptions yij = m + ai + eij where yij = jth mileage driven before failure using ith pump design m = overall mean mileage ai = fixed effect of the ith design on mileage eij = random experimental error, NID(0,s2) Prespecified Contrasts Are these statistics optimal ? Companies t sC Company A A B B Divisor yA yB 1/ n A 1/ n B Designs 1 vs. 3 y1 y 3 t s1&3 1 / n1 1 / n 3 Design # 1 2 3 4 Average Miles Driven y1 y2 y3 y4 Designs 1&3 vs. 2&4 y1&3 y 2&4 t s D 1 / n1&3 1 / n 2&4 Designs 2 vs. 4 y2 y4 t s 2& 4 1 / n 2 1 / n 4 t-test Comparison of Company Effects The TTEST Procedure Statistics Variable company mileage mileage mileage A B Diff (1-2) N 20 20 Lower CL Mean Mean Upper CL Mean Lower CL Std Dev Std Dev 26430 24630 849.45 27896 25431 2465.5 29363 26232 4081.6 2382.8 1301.4 2063.1 3133.2 1711.3 2524.4 Statistics Variable company mileage mileage mileage A B Diff (1-2) Upper CL Std Dev Std Err Minimum Maximum 4576.3 2499.4 3253.4 700.6 382.65 798.29 24215 21613 31416 27724 DF t Value Pr > |t| 38 29.4 3.09 3.09 0.0037 0.0044 T-Tests Variable Method Variances mileage mileage Pooled Satterthwaite Equal Unequal t-test Comparison of Designs 1&3 with Designs 2&4 Designs Recoded: 1 & 3 = 1, 2 & 4 = 2 The TTEST Procedure Statistics Variable mileage mileage mileage design N 2 4 10 10 Diff (1-2) Lower CL Mean Mean Upper CL Mean Lower CL Std Dev Std Dev 24506 26158 -2251 24870 26594 -1724 25235 27030 -1196 350.47 419.17 424.42 509.53 609.41 561.69 Statistics Variable mileage mileage mileage design 2 4 Diff (1-2) Upper CL Std Dev Std Err Minimum Maximum 930.2 1112.5 830.65 161.13 192.71 251.2 24215 25804 25930 27724 T-Tests Variable Method Variances mileage mileage Pooled Satterthwaite Equal Unequal DF t Value Pr > |t| 18 17.5 -6.86 -6.86 <.0001 <.0001 t-test Comparison of Design #1 with Design #3 The TTEST Procedure Statistics Variable mileage mileage mileage design N 1 3 10 10 Diff (1-2) Lower CL Mean Mean Upper CL Mean Lower CL Std Dev Std Dev 30675 23070 5518.5 30922 24268 6654.5 31169 25465 7790.5 237.72 1151.8 913.56 345.61 1674.5 1209 Statistics Variable mileage mileage mileage design 1 3 Diff (1-2) Upper CL Std Dev Std Err Minimum Maximum 630.95 3057 1787.9 109.29 529.53 540.69 30321 21613 31416 26233 T-Tests Variable Method Variances mileage mileage Pooled Satterthwaite Equal Unequal DF t Value Pr > |t| 18 9.77 12.31 12.31 <.0001 <.0001 t-test Comparison of Design #2 with Design #4 The TTEST Procedure Statistics Variable mileage mileage mileage design N 2 4 10 10 Diff (1-2) Lower CL Mean Mean Upper CL Mean Lower CL Std Dev Std Dev 24506 26158 -2251 24870 26594 -1724 25235 27030 -1196 350.47 419.17 424.42 509.53 609.41 561.69 Statistics Variable mileage mileage mileage design 2 4 Diff (1-2) Upper CL Std Dev Std Err Minimum Maximum 930.2 1112.5 830.65 161.13 192.71 251.2 24215 25804 25930 27724 T-Tests Variable Method Variances mileage mileage Pooled Satterthwaite Equal Unequal DF t Value Pr > |t| 18 17.5 -6.86 -6.86 <.0001 <.0001 t-test Comparisons Incorrect Analyses: Standard deviations are inefficient and possibly biased Linear Model Analysis The ANOVA Procedure Dependent Variable: mileage DF Sum of Squares Mean Square F Value Pr > F Model 3 270956900.1 90318966.7 101.64 <.0001 Error 36 31990423.8 888622.9 Corrected Total 39 302947323.9 Source R-Square Coeff Var Root MSE mileage Mean 0.894403 3.535431 942.6680 26663.45 Source DF Anova SS Mean Square F Value Pr > F design 3 270956900.1 90318966.7 101.64 <.0001 Analysis of Water Pump Prototypes Comparison of All 4 Designs H0: ai = 0 for all i vs Ha: ai 0 for some i Reject H0 and accept Ha if F > F0.05(3,36) = 2.87 From the ANOVA Table, F = 101.64. Conclusion On the basis of this analysis, there is sufficient evidence (p = 0.001) to conclude that the mean mileage before failure of these prototype pumps differs by design type. Analysis of Water Pump Prototypes Multiple Comparisons of Pump Design Average Mileages Design Average 3 24,268 2 24,870 4 26,594 1 30,922 Using Fisher’s Least Significant Difference procedure, average mileages for two designs are significantly different from each other if their difference exceeds 1,135.4 miles. As indicated by the line in the above table, the average mileages for Designs 2 and 3 are not significantly different. Mileages for all other pairwise comparisons of designs are significantly different; in particular, Design 1 has a significantly greater average mileage measurement than the other designs. Prespecified Contrasts Company A A B B Divisor Design # 1 2 3 4 Possible Comparisons Designs for Designs for Companies Company A Company B 1 1 0 1 -1 0 -1 0 1 -1 0 -1 2 1 1 Companies t Company A t Company B t se se se yA yB 1/ nA 1/ n B y1 y 2 1 / n1 1 / n 2 y3 y 4 1/ n3 1/ n 4 Average Miles Driven y1 y2 y3 y4 Contrasts: the Details Companies t yA yB 1/ nA 1/ n B se 1 1 1 y A y B ( y1 y 2 ) ( y3 y 4 ) ( y1 y 2 y3 y 4 ) 2 2 2 s yA yB 1/ 2 1 s s s s r r r 4 r 2 2 2 2 1/ 2 s2 s2 n A n B 1/ 2 1 1 s n A n B , n A n B 2r Start with difference of averages Contrasts: the Details Companies t yA yB 1/ nA 1/ n B se y1 y 2 y3 y 4 s y1 y2 y3 y4 2 1 / 2 s s s s r r r r 2 2 2 1/ 2 1 1 2s n A n B Start with a contrast Orthogonal Sets of Contrasts Company A A B B Design # 1 2 3 4 Possible Comparisons Designs for Designs for Companies Company A Company B 1 1 0 1 -1 0 -1 0 1 -1 0 -1 Average Miles Driven y1 y2 y3 y4 Possible Comparisons Company A A B B Design # 1 2 3 4 Companies 1 1 -1 -1 (1&3) vs. (2&4) (1&4) vs. (2&3) 1 1 -1 -1 1 -1 -1 1 Many other sets of orthogonal contrasts Average Miles Driven y1 y2 y3 y4 General Method for Forming Orthogonal Contrasts 1 1 1 1 1 1 1 1 y1 2 1 * 0 * * 1 * c1 , c 2 , c 3 , . . . , c k-1 0 0 3 1 y = ... y k . . . . . . . . . ... 0 0 0 (k 1) Orthonormal : c j {j( j 1)}1 c *j j = 1, 2, . . . , k - 1 k-1 ANY Contrast Vector c = a jc j j=1 Some Contrasts for Comparing Factor Level Averages a (a 1 a 2 ... a a ) Comparing Two Factor Level Effects a i a j c a c (0 ... 0 1 0 ... 0 - 1 0 ... ) / 2 Comparing the Mean of Two Factor Level Effects with a Third Factor Effect ai a j ak or a i a j 2a k 2 c (0 . .. 0 1 0 . .. 0 1 0 . .. 0 - 2 0 . . . 0) / 6 One Set of Main Effects Contrasts : Qualitative Factor Levels 1 1 1 1 1 1 1 1 1 c1 , c2 , c3 2 0 6 2 12 1 0 0 3 1 c1 a a 1 a 2 a1 a 2 2 c2 a a3 2 a1 a 2 a 3 3 c3 a a4 3 Main Effects Contrasts : Qualitative Factor Levels 1 1 1 1 1 1 1 1 1 c1 , c2 , c3 2 0 6 2 12 1 0 0 3 Three statistically independent contrasts of the response averages A partitioning of the main effects degrees of freedom into single degree-of-freedom contrasts (a = 4: df = 3) Sums of Squares and Contrasts C a x (a-1) = c 1 c 2 ... c a-1 1/ 2 Pa x a a Orthonormal Basis Set 1a : C PP I a a 1J a CC CC I a a 1J a SS A r (y i - y ) 2 ry ( I a a 1 J a ) y ry CC y r (ci y ) 2 a-1 mutually orthonormal contrast vectors ANY set of orthonormal contrast vectors Simultaneous Test Single degree-offreedom contrasts Possible Analyses of Water Pump Prototypes Source Four Distinct Designs Design df S.S. 3 270,956,900 Single Degree of Freedom Contrasts Companies 1 Designs for Company #1 1 Designs for Company #2 1 Total 3 60,786,902 183,109,313 27,060,685 270,956,900 Two Fixed Designs for Each Company Companies 1 Designs 1 Companies x Designs 1 Total 3 60,786,902 34,692,788 175,477,210 270,956,900 Warping of Copper Plates: Quantitative Factor Levels Temperature 50 75 100 125 Average 40 17,20 12,9 16,12 21,17 15.50 Copper Content 60 80 16,21 24,22 18,13 17,12 18,21 25,23 23,21 23,22 18.87 21.00 100 28,27 27,31 30,23 29,31 28.25 Average 21.88 17.38 21.00 23.38 20.91 MGH Table 6.7 Model and Assumptions yijk = m + ai + bj + (ab)ij + eijk where ai b j (ab)ij (ab)ij 0, i j i j yijk = warping measurement for the kth repeat at the ith temp. using a plate having the jth amount of copper m = overall mean warping measurement ai = fixed effect of the ith temperature on the mean warping bi = fixed effect of the jth copper content on the mean warping (ab)ij = fixed effect of the interaction between the ith temperature and the jth copper content on the mean warping eij = random experimental error, NID(0,s2) Warping of Copper Plates Source Copper Content Temperature Cx T Error Total df 3 3 9 16 31 SS 698.34 156.09 113.78 108.50 1076.71 MS 232.78 52.03 12.64 6.78 F 34.33 7.67 1.86 p-Value 0.000 0.002 0.134 Quantitative factor levels HOW does mean warping change with the factor levels ? MGH Table 6.7 Warping of Copper Plates Are there contrast vectors that quantify curvature ? 35 30 Average 25 Warping 20 15 10 0 50 75 100 125 Temperature (deg F) 150 Warping of Copper Plates Are there contrast vectors that quantify curvature ? 35 30 Average 25 Warping 20 15 10 0 20 40 60 80 Copper Content (%) 100 Main Effects Contrasts : Quantitative Factor Levels Assumption Mean response can be well approximated by a low-order polynomial function of the factor levels yij m ai eij b0 b1x i b2 x i2 ... + eij Assumption : m ai b0 b1x i b2 x i2 ... Orthogonal Polynomials Coded Factor Levels xi = a0 + a1i Equally Spaced e.g., Temp = 50, 75, 100, 125 >>>> xi = 25 + 25i Orthogonal Polynomials y ij b 0 b 1x b 2 x 2 . . . + e ij 0 1c1 2 c 2 .. . + e ij With coded factor levels, orthogonal polynomials are only a function of n Not Orthongonal Orthogonal Orthogonal Polynomials Linear Effect c1 a 0 1 x Orthogonality Constraint c1’1 = 0 Orthogonal Polynomials Linear Effect c1 a 0 1 x Orthogonality Constraint c1’1 = 0 Solution a 0 n xi 0 a 0 x c1 x x1n {x i x} Centered Data Values Linear Orthogonal Polynomial (Coded Factor Levels) n 1 1 2 n 1 c1 2 2 ... n n 1 2 n=4 1.5 3 0.5 1 c1 0.5 1 1.5 3 Orthogonal Polynomials Quadratic Effect c 2 a 0 1 a 1x x 2 Orthogonality Constraints c2’1 = 0 and c2’c1 = 0 Solution a 0 n a1 x i x i2 0 a 0 ( x i x ) a1 x i ( x i x ) x i2 ( x i x ) 0 Main Effects Contrasts : Equally Spaced Quantitative Factor Levels Recurrence Relation for Coded Levels c i,0 1 n1 c i,1 i 2 c i, j1 c i,1c i, j j2 (n 2 j2 ) 4(4 j 1) 2 c i, j1 j = 2, 3, ... , n - 1 Main Effects Contrasts : Equally Spaced Quantitative Factor Levels n=4 3 1 1 1 1 1 1 1 3 c1 , c2 , c3 2 1 20 1 20 3 3 1 1 1 = Linear 2 = Quadratic 3 = Cubic Linear Combinations of Parameters Estimable Functions of Parameters ci m i Estimator Standard Error ˆ ci yi Same for Contrasts seˆ s t Statistic ci2 /r 1/ 2 ˆ t , F t2 se ˆ Average warping measurements. 24 29 Changes in Average Warping Possible Trends in Average Warping 28 23 27 26 25 Average warping Average warping 22 21 20 19 24 23 22 21 20 19 18 18 17 16 17 15 50 75 100 T emperature (deg C) 125 40 60 80 Copper content (%) 100 Warping of Copper Plates Temperature 50 75 100 125 Normalized Contrast Single df S.S. Linear -3 -1 1 3 1.82 26.41 Quadratic 1 -1 -1 1 3.44 94.53 Cubic -1 3 -3 1 -2.09 35.16 1/ 2 2 ˆ Normalized Contrast : j cij yi / cij i1 i 1 Single df Sum of Squares : br ˆ 2j 4 4 Average 21.88 17.38 21.00 23.38 156.10 SAS Output The GLM Procedure Dependent Variable: warping Warping Measurement Source DF Sum of Squares Mean Square F Value Pr > F Model 15 968.218750 64.547917 9.52 <.0001 Error 16 108.500000 6.781250 Corrected Total 31 1076.718750 R-Square Coeff Var Root MSE warping Mean 0.899231 12.45600 2.604083 20.90625 Source temp content temp*content Source temp content temp*content Contrast Linear Temperature Quadratic Temperature Cubic Temperature Linear Copper Content Quadratic Copper Content Cubic Copper Content DF Type I SS Mean Square F Value Pr > F 3 3 9 156.0937500 698.3437500 113.7812500 52.0312500 232.7812500 12.6423611 7.67 34.33 1.86 0.0021 <.0001 0.1327 DF Type III SS Mean Square F Value Pr > F 3 3 9 156.0937500 698.3437500 113.7812500 52.0312500 232.7812500 12.6423611 7.67 34.33 1.86 0.0021 <.0001 0.1327 DF Contrast SS Mean Square F Value Pr > F 1 1 1 1 1 1 26.4062500 94.5312500 35.1562500 652.0562500 30.0312500 16.2562500 26.4062500 94.5312500 35.1562500 652.0562500 30.0312500 16.2562500 3.89 13.94 5.18 96.16 4.43 2.40 0.0660 0.0018 0.0369 <.0001 0.0515 0.1411 Scaled Contrasts Note: Need scaling to make polynomial contrasts comparable ˆ k a i y i i 1 ˆ s k a i y i i 1 , var (ˆ ) se2 a i2 / n k i 1 1/ 2 k a 2 /n i i1 , var (ˆ s ) se2 Warping of Copper Plates Copper Content Linear Quadratic Cubic 40 -3 1 -1 60 -1 -1 3 80 1 -1 -3 100 3 1 1 Scaled Effect 25.51 5.47 4.04 95% C.I. (19.99,31.03) (-0.05,10.99) (-1.48,9.56) Average 15.50 18.88 21.00 28.25 Note: Quadratic Effect is Forced to be Orthogonal to Linear Cubic Effect is Forced to be Orthogonal to Linear and Quadratic Single Degree of Freedom Contrasts for Interactions Linear x Linear Linear Linear -3 -1 1 3 -3 9 3 -3 -9 -1 3 1 -1 -3 1 -3 -1 1 3 3 -9 -3 3 9 2(xi x )