Week 9: Orthogonal comparisons for a 2x2 factorial design. The general two-factor factorial arrangement. Interaction and additivity. ANOVA summary table, tests, CIs. Planned/post-hoc comparisons for the factors or treatments. (ch13) [pp13-153] Orthogonal contrasts for a 2x2 factorial design Example p13 Tabulated statistics: Stress, Diet Rows: Stress D1 Columns: Diet D2 High 1.5 2.3 1. 2.2 1.6 2. Low.3...3.2.5 Cell Contents: Cholesterol : Mean Cholesterol : DATA 1
Data Display D1_HighStress D2_HighStress D1_LowStress D2_LowStress 1. 2.2..3 1.6 2..2.5 One-way ANOVA: D1_HighStress, D2_HighStress, D1_LowStress, D2_LowStress Factor 3 5.55 1.8183 9.92. Error.8.2 Total 7 5.535 S =.11 R-Sq = 98.55% R-Sq(adj) = 97.7% Individual 95% CIs For Mean Based on Pooled StDev Level N Mean StDev +---------+---------+---------+--------- D1_HighStress 2 1.5.11 (---*---) D2_HighStress 2 2.3.11 (---*---) D1_LowStress 2.3.11 (---*---) D2_LowStress 2..11 (---*---) +---------+---------+---------+---------..7 1. 2.1 2.5 2. Interaction Plot (data means) for Cholesterol Stress High Low Mean 1.5 1..5 D1 Diet D2 2
H : No interaction in the effects of the two factors H : µ µ = µ µ S1D1 S1D2 S2D1 S2D2 H : µ µ µ µ S1D1 S1D2 S2D1 S2D2 H : µ + µ µ + µ SD 1 1 S2D2 SD 1 2 S2D2 ψ = µ µ µ µ int S1D1 S1D2 S2D1 S2D2 Check that the three contrasts are orthogonal. SS (int contrast) =.25 SS(Stress) =.85 SS(Diet) =.5 = = µ SD 1 1 µ = simple effect of diet at low SD 1 2 stress level µ SD 1 1 µ = simple effect of diet at high SD 1 2 stress level 3
Note: When the interaction is significant, the tests for main effect hypotheses are of dubious value. P132 CN - illustrative plots are important - interaction between two factors A and B implies that both factors have effects, but the effect of factor A depend on the level of factor B present and vice versa. P133 CN - Three way interaction
The model: The General Two Factor Model Observation = fit + error y ijk = µ ij + ε ijk y ijk = µ + µ µ µ µ µ + ε ijk effect of level i of factor A = µ ( µ ) + ( µ ) + ( ij i + µ ) µ i effect of level j of factor B = µ µ j interaction effect at treatment (i,j) = µ ij µ µ + µ i j ε ijk ~ iid N (, σ ) Estimates y ijk = y + ( y i y) + ( y j y) + ( y ij y i y j + y) + ( y ijk y ij ) 5
SS decomposition SSTot = SSA + SSB +SS(AB)+SSE It can be shown that SS(AB) = SSTrt SS(A)-SS(B) 6
Standard hypotheses: H (1) : no interaction H (2) : there is no main effect of factor A i.e µ µ = for all i i H (3) : there is no main effect of factor B i.e µ µ = for all j j 7
Example (Example 3 CN p11) Data Display Row Yield Variety Nitrogen 1 9 1 15 2 39 1 15 3 55 1 2 1 1 2 5 66 1 25 6 68 1 25 7 5 2 15 8 55 2 15 9 67 2 2 1 58 2 2 11 85 2 25 12 92 2 25 13 3 3 15 1 38 3 15 15 53 3 2 16 2 3 2 17 69 3 25 18 62 3 25 19 53 15 2 8 15 21 85 2 22 73 2 23 85 25 2 99 25 8
Or I tabulated form: Tabulated statistics: Nitrogen, Variety Rows: Nitrogen Columns: Variety 1 2 3 15 9 5 3 53 39 55 38 8 2 55 67 53 85 1 58 2 73 25 66 85 69 85 68 92 62 99 Cell Contents: Yield : DATA 9
One-way ANOVA: Yield versus Trt Trt 11 668.5 67.3 1.36. Error 12 57.5 2.3 Total 23 7188. Residual Plots for Yield 99 Normal Probability Plot of the Residuals 8 Residuals Versus the Fitted Values 9 Percent 5 1 Residual - 1-1 -5 Residual 5 1-8 6 Fitted Value 8 Histogram of the Residuals 8 Residuals Versus the Order of the Data Frequency 3 2 1 Residual - -6 - -2 2 Residual 6 8-8 2 6 8 1 12 1 16 18 Observation Order 2 22 2 1
Two-way ANOVA: Yield versus Nitrogen, Variety Nitrogen 2 3996.8 1998. 7.2. Variety 3 2227.6 72.9 17.56. Interaction 6 56.92 76.15 1.8.182 Error 12 57.5 2.29 Total 23 7187.96 S = 6.53 R-Sq = 92.9% R-Sq(adj) = 86.7% Residual Plots for Yield Normal Probability Plot of the Residuals Residuals Versus the Fitted Values 99 8 9 Percent 5 1 Residual - 1-1 -5 Residual 5 1-8 6 Fitted Value 8 Histogram of the Residuals 8 Residuals Versus the Order of the Data Frequency 3 2 1 Residual - -6 - -2 2 Residual 6 8-8 2 6 8 1 12 1 16 18 Observation Order 2 22 2 Anderson Darling test for normality Probability Plot of RESI1 Normal Percent 99 95 9 8 7 6 5 3 2 Mean StDev.697 N 2 AD.63 P-Value.82 1 5 1-1 -5 RESI1 5 1 11
Interaction Plot (data means) for Yield 9 8 Variety 1 2 3 Mean 7 6 5 15 2 Nitrogen 25 12
Compare the two ANOVA tables above One-way ANOVA: Yield versus Trt Trt 11 668.5 67.3 1.36. Error 12 57.5 2.3 Total 23 7188. S = 6.53 R-Sq = 92.9% R-Sq(adj) = 86.7% Two-way ANOVA: Yield versus Nitrogen, Variety Nitrogen 2 3996.8 1998. 7.2. Variety 3 2227.6 72.9 17.56. Interaction 6 56.92 76.15 1.8.182 Error 12 57.5 2.29 Total 23 7187.96 S = 6.53 R-Sq = 92.9% R-Sq(adj) = 86.7% 13
Elements of the ANOVA table Tabulated statistics: Nitrogen, Variety Rows: Nitrogen Columns: Variety 1 2 3 All 15. 52.5.5 5.5 6.88 88 15 81 11 375 7.71 3.536 3.536 3.536 6.266 2 2 2 2 8 9 5 3 53 39 55 38 8 2 8. 62.5 7.5 79. 59.25 96 125 95 158 7 9.899 6.36 7.778 8.85 15.126 2 2 2 2 8 55 67 53 85 1 58 2 73 25 67. 88.5 65.5 92. 78.25 13 177 131 18 626 1.1.95.95 9.899 13.79 2 2 2 2 8 66 85 69 85 68 92 62 99 All 53. 67.83 51.17 73.83 61.6 318 7 37 3 175 12.28 17.81 12.352 19.92 17.678 6 6 6 6 2 Cell Contents: Yield : Mean Yield : Sum Yield : Standard deviation Count Yield : DATA 1
Further analysis Two-way ANOVA: Yield versus Nitrogen, Variety Nitrogen 2 3996.8 1998. 7.2. Linear 1 3937.56 sig Quadratic 1 58.52 n.s. Variety 3 2227.6 72.9 17.56. 1 vs 3 1 1.83 n.s 2 vs 1 n.s (1,3) vs (2,) sig Interaction 6 56.92 76.15 1.8.182 Error 12 57.5 2.29 Total 23 7187.96 8 Main Effects Plot (data means) for Yield 75 7 Mean of Yield 65 6 55 5 5 15 2 Nitrogen 25 15
CI for the difference between means at two levels of variety (or nitrogen) y y ± t 1 1 i j /2 s n + α n i j Ex Find a 95% CI for the difference between the means of variety 1 and variety 2 Ex Find a 95% CI for the difference between the means of the treatments (V1, 15) and (V2 and 15). 16
Fits and residuals from the interaction model ANOVA: Yield versus Nitrogen, Variety Factor Type Levels Values Nitrogen fixed 3 15, 2, 25 Variety fixed 1, 2, 3, Analysis of Variance for Yield Nitrogen 2 3996.8 1998. 7.2. Variety 3 2227.6 72.9 17.56. Nitrogen*Variety 6 56.92 76.15 1.8.182 Error 12 57.5 2.29 Total 23 7187.96 S = 6.532 R-Sq = 92.9% R-Sq(adj) = 86.7% Data Display Row Yield Variety Nitrogen RESI1 FITS1 1 9 1 15 5.. 2 39 1 15-5.. 3 55 1 2 7. 8. 1 1 2-7. 8. 5 66 1 25-1. 67. 6 68 1 25 1. 67. 7 5 2 15-2.5 52.5 8 55 2 15 2.5 52.5 9 67 2 2.5 62.5 1 58 2 2 -.5 62.5 11 85 2 25-3.5 88.5 12 92 2 25 3.5 88.5 13 3 3 15 2.5.5 1 38 3 15-2.5.5 15 53 3 2 5.5 7.5 16 2 3 2-5.5 7.5 17 69 3 25 3.5 65.5 18 62 3 25-3.5 65.5 19 53 15 2.5 5.5 2 8 15-2.5 5.5 21 85 2 6. 79. 22 73 2-6. 79. 23 85 25-7. 92. 2 99 25 7. 92. 17
Additive model ANOVA: Yield versus Nitrogen, Variety Factor Type Levels Values Nitrogen fixed 3 15, 2, 25 Variety fixed 1, 2, 3, Analysis of Variance for Yield Nitrogen 2 3996.1 1998. 37.29. Variety 3 2227.5 72.5 13.86. Error 18 96. 53.6 Total 23 7188. S = 7.31975 R-Sq = 86.58% R-Sq(adj) = 82.86% - Compare with the interaction model ANOVA: Yield versus Nitrogen, Variety Factor Type Levels Values Nitrogen fixed 3 15, 2, 25 Variety fixed 1, 2, 3, Analysis of Variance for Yield Nitrogen 2 3996.8 1998. 7.2. Variety 3 2227.6 72.9 17.56. Nitrogen*Variety 6 56.92 76.15 1.8.182 Error 12 57.5 2.29 Total 23 7187.96 S = 6.532 R-Sq = 92.9% R-Sq(adj) = 86.7% 18
Residuals from the additive model Data Display Row Yield Variety Nitrogen RESI1 FITS1 1 9 1 15 1.5833 38.167 2 39 1 15.5833 38.167 3 55 1 2.283 5.7917 1 1 2-9.7917 5.7917 5 66 1 25-3.7917 69.7917 6 68 1 25-1.7917 69.7917 7 5 2 15-3.25 53.25 8 55 2 15 1.75 53.25 9 67 2 2 1.375 65.625 1 58 2 2-7.625 65.625 11 85 2 25.375 8.625 12 92 2 25 7.375 8.625 13 3 3 15 6.167 36.5833 1 38 3 15 1.167 36.5833 15 53 3 2.17 8.9583 16 2 3 2-6.9583 8.9583 17 69 3 25 1.17 67.9583 18 62 3 25-5.9583 67.9583 19 53 15-6.25 59.25 2 8 15-11.25 59.25 21 85 2 13.375 71.625 22 73 2 1.375 71.625 23 85 25-5.625 9.625 2 99 25 8.375 9.625 19
GLM approach for unbalanced designs (eg if some observations are missing) -Use indicator variables for qualitative factors and use GLM approach using regression procedure Regression Analysis: Yield versus Nitrogen, nsq,... The regression equation is Yield = - 128 + 1.65 Nitrogen -.31 nsq + 25 v1 + 26 v2 + 213 v3-2.62 v1n - 2.57 v2n - 2.28 v3n - +.61 v1nsq +.63 v2nsq +.53 v3nsq S = 6.532 R-Sq = 92.9% R-Sq(adj) = 86.5% Analysis of Variance Regression 11 668.6 67.31 1.36. Residual Error 12 57.5 2.29 Total 23 7187.96 Source DF Seq SS Nitrogen 1 3937.56 nsq 1 58.52 v1 1 572.35 v2 1 113.78 v3 1 151.33 v1n 1 93.52 v2n 1 5. v3n 1 136.13 v1nsq 1 31.17 v2nsq 1 7.1 v3nsq 1 117. - Note: we should include nitrogen_sq (denoted n2 above ) when there are three levels for that factor 2
- Compare with ANOVA approach ANOVA: Yield versus Nitrogen, Variety Factor Type Levels Values Nitrogen fixed 3 15, 2, 25 Variety fixed 1, 2, 3, Analysis of Variance for Yield Nitrogen 2 3996.8 1998. 7.2. Variety 3 2227.6 72.9 17.56. Nitrogen*Variety 6 56.92 76.15 1.8.182 Error 12 57.5 2.29 Total 23 7187.96 21