Factorial Treatments (§ 14.3, 14.4, 15.4) Completely randomized designs - One treatment factor at t levels. Randomized block design - One treatment factor at t levels, one block factor at b levels. Latin square design - One treatment factor at t levels, two block factors, each at t levels. Many other blocking structures are available. Check the literature on Experimental Design. Now we move on to the situation where the t treatment levels are defined as combinations of two or more “factors”. Factor – a controlled variable (e.g. temperature, fertilizer type, percent sand in concrete mix). Factors can have several levels (subdivisions). 22-1 Example 1 of Factors What factors (characteristics, conditions) will make a wiring harness for a car last longer? FACTOR Number of strands Length of unsoldered, uninsulated wire (in 0.01 inches) Diameter of wire (gauge) Levels 7 or 9. 0, 3, 6, or 12. 24, 22, or 20 A treatment is a specific combination of levels of the three factors. T1 = ( 7 strand, 0.06 in, 22 gauge) Response is the number of stress cycles the harness survives. 22-2 Example 2 of Factors What is the effect of temperature and pressure on the bonding strength of a new adhesive? Factor x1: temperature (any value between 30oF to 100oF) Factor x2: pressure (any value between 1 and 4 kg/cm2 Factors (temperature, pressure) have continuous levels, Treatments are combinations of factors at specific levels. Response is bonding strength - can be determined for any combination of the two factors. Response surface above the (x1 by x2) Cartesian surface. 22-3 Other Examples of Factors • • • • • The effect of added Nitrogen, Phosphorus and Potassium on crop yield. The effect of replications and duration on added physical strength in weight lifting. The effect of age and diet on weight loss achieved. The effect of years of schooling and gender on Math scores. The effect of a contaminant dose and body weight on liver enzyme levels. Since many of the responses we are interested in are affected by multiple factors, it is natural to think of treatments as being constructed as combinations of factor levels. 22-4 One at a Time Approach Consider a Nitrogen and Phosphorus study on crop yield. Suppose two levels of each factor were chosen for study: N@(40,60), P@(10,20) lbs/acre. One-factor-at-atime approach: Fix one factor then vary the other Treatment T1 T2 T3 N 60 40 40 P 10 10 20 Yield 145 125 160 Parameter m1 m2 m3 H0: m1-m2 = test of N-effect (20 unit difference observed in response). H0: m2-m3 = test of P-effect (35 unit difference observed in response). If I examined the yield at N=60 and P=20 what would I expect to find? E(Y | N=60,P=20) = m3+(m1 - m2) = 160 + 20 = 180? E(Y | N=60,P=20) = m2+(m1 - m2)+(m3 - m2) = 125+20+35 = 180? 22-5 Interaction and Parallel Lines We apply the N=60, P=20 treatment and get the following: Yield Treatment T1 T2 T3 T4 N 60 40 40 60 P 10 10 20 20 Yield 145 125 160 130 Parameter m1 m2 m3 m4 Expected T4 180 170 T3 160 T1 150 140 130 120 Observed T4 20 T2 10 20 P 22-6 Parallel and Non-Parallel Profiles 180 170 160 150 140 130 120 20 10 20 Parallel Lines => the effect of the two factors is additive (independent). Non-Parallel Lines => the effect of the two factors interacts P (dependent). The effect of one factor on the response does not remain the same for different levels of the second factor. That is, the factors do not act independently of each other. Without looking at all combinations of both factors, we would not be able to determine if the factors interact. 22-7 Factorial Experiment Factorial Experiment - an experiment in which the response y is observed at all factor level combinations. An experiment is not a design. (e.g. one can perform a factorial experiment in a completely randomized design, or in a randomized complete block design, or in a Latin square design.) Design relates to how the experimental units are arranged, grouped, selected and how treatments are allocated to units. Experiment relates to how the treatments are formed. In a factorial experiment, treatments are formed as combinations of factor levels. (E.g. a fractional factorial experiment uses only a fraction (1/2, 1/3, 1/4, etc.) of all possible factor level combinations.) 22-8 General Data Layout Two Factor (a x b) Factorial Row Factor(A) 1 2 3 … a Totals 1 T11 T21 T31 … Ta1 B1 Column Factor (B) 2 3 … b T12 T13 … T1b T22 T23 … T2b T32 T33 … T3b … … … … Ta2 Ta3 … Tab B2 B3 … Bb Totals A1 A2 A3 ... Aa G n Tij yijk yij k 1 b Ai Tij yi j 1 a B j Tij y j i 1 a b n G yijk y i 1 j 1 k 1 yijk= observed response for the kth replicate (k=1,…,n) for the treatment defined by the combination of the ith level of the row factor and the jth level of the column factor. 22-9 Model mij = mean of the ijth table cell, yijk m ij + ijk expected value of the response for the combination for the ith row factor level and the jth column factor level. Overall Test of no treatment differences: Ho: all mij are equal Ha: at least two mij differ Test as in a completely randomized design with a x b treatments. 22-10 Sums of Squares 2 TSS ( yijk y ) a b n i 1 j 1 k 1 2 G 2 yijk abn i 1 j 1 k 1 a 2 SSCells n ( yij y ) a b i 1 j 1 b n 1 a b 2 G2 Tij n i 1 j 1 abn 2 SSE ( yijk yij ) TSS SSCells a b n i 1 j 1 k 1 df total abn 1 df cells ab 1 df within ab(n 1) SSE MSE ˆ 2 df within SSCells df cells F , follows an Fdfcells ,dfwithin MSE 22-11 After the Overall F test As with any experiment, if the hypothesis of equal cell means is rejected, the next step is to determine where the differences are. In a factorial experiment, there are a number of predefined contrasts (linear comparisons) that are always of interest. • Main Effect of Treatment Factor A - Are there differences in the means of the factor A levels (averaged over the levels of factor B). • Main Effect of Treatment Factor B - Are there differences in the means of the factor B levels (averaged over the levels of factor A). • Interaction Effects of Factor A with Factor B - Are the differences between the levels of factor A the same for all levels of factor B? (or equivalently, are the differences among the levels of factor B the same for all levels of factor A? (Yes no interaction present; no interaction is present.) 22-12 Main Effects Column Factor (B) Row Factor(A) 1 2 3 … b 1 m11 m12 m13 … m1b m1 2 m21 m22 m13 … m1b m2 3 m31 m32 m13 … m1b m3 … … … … … … a ma1 ma2 ma3 … mab ma m1 m 2 m 3 … m b m Totals Factor A main effects: H 0 : m1 m a ... 1 b 1 1 m1 m11 + + m1b m1 j b j 1 b b Testing is via a set of linear comparisons. 22-13 Testing for Main Effects: Factor A There are a levels of Treatment Factor A. This implies that there are a-1 mutually independent linear contrasts that make up the test for main effects for Treatment Factor A. The Sums of Squares for the main effect for treatment differences among levels of Factor A is computed as the sum of the individual contrast sums of squares for any set of a-1 mutually independent linear comparisons of the a level means. Regardless of the chosen set, this overall main effect sums of squares will always equal the value of SSA below. 2 a SSA nb ( yi y ) , SSA MSA a 1 i 1 H 0 : m1 m a MSA F , follows an Fa 1,ab( n 1) MSE Reject H0 if F > F(a-1),ab(n-1),a 22-14 Profile Analysis for Factor A Mean for level 5 of Factor A Mean for level 1 of Factor A m53 180 170 m11 m51 m5 160 150 140 130 120 m1 m13 m12 m m52 1 2 Profile for level 2 of Factor B. 3 Factor A Levels 4 5 Profile of mean of Factor A (main effect of A). 22-15 Insignificant Main Effect for Factor A 180 170 160 150 140 130 120 m11 m13 m1 m51 m5 m12 m52 1 2 3 Factor A Levels 4 m 5 Is there strong evidence of a Main Effect for Factor A? SSA small (w.r.t. SSE) No. 22-16 Significant Main Effect for Factor A 180 170 m 160 150 140 130 120 1 2 3 Factor A Levels 4 5 Is there strong evidence of a Main Effect for Factor A? SSA large (w.r.t. SSE) Yes. 22-17 Main Effect Linear Comparisons - Factor A Column Factor (B) Row Factor(A) 1 2 b=3 1 m11 m12 m13 m1 2 m21 m22 m13 m2 3 m31 m32 m13 m3 4 m41 m42 m43 m4 a=5 m51 m52 m53 m5 Totals m1 m 2 m 3 m H 0 : m1 m a 1 1 1 3 3 3 E ( yijk ) m ij m + i + j m1 m11 + m12 + m13 Testing via a set of linear comparisons. L1 : m1 m 5 1 5 0 L2 : m 2 m 5 2 5 0 L3 : m 3 m 5 3 5 0 Not mutually orthogonal, but together they represent a-1=4 dimensions of comparison. L4 : m 4 m 5 4 5 0 22-18 Main Effect Linear Comparisons - Factor B Column Factor (B) Row Factor(A) 1 2 b=3 1 m11 m12 m13 m1 2 m21 m22 m13 m2 3 m31 m32 m13 m3 4 m41 m42 m43 m4 a=5 m51 m52 m53 m5 Totals m1 m2 m3 m H 0 : m 1 m b L1 : m 1 m 3 1 3 0 L2 : m 2 m 3 2 3 0 1 1 5 5 E ( yijk ) m ij m + i + j 1 5 m 1 m11 + m 21 + + m 51 Testing via a set of linear comparisons. Not mutually orthogonal, but together they represent b-1=2 dimensions of comparison. 22-19 Testing for Main Effects: Factor B There are b levels of Treatment Factor B. This implies that there are b-1 mutually independent linear contrasts that make up the test for main effects for Treatment Factor B. The Sums of Squares for the main effect for treatment differences among levels of Factor B is computed as the sum of the individual contrast sums of squares for any set of b-1 mutually independent linear comparisons of the b level means. Regardless of the chosen set, this overall main effect sums of squares will always equal the value of SSB below. 2 SSB na ( y j y ) , b SSB MSB b 1 j 1 H0 : m1 mb MSB F , follows an Fb 1,ab( n 1) MSE Reject H0 if F > F(b-1),ab(n-1),a 22-20 Interaction Two Factors, A and B, are said to interact if the difference in mean response for two levels of one factor is not constant across levels of the second factor. 180 180 160 160 140 140 120 120 1 2 3 4 5 Factor A Levels Differences between levels of Factor B do not depend on the level of Factor A. 1 2 3 5 4 Factor A Levels Differences between levels of Factor B do depend on the level of Factor A. 22-21 Interaction Linear Comparisons m21 180 Interaction is lack of consistency in differences between two levels of Factor B across levels of Factor A. (m11 m12 ) (m51 m52 ) 0 (m 21 m 22 ) (m51 m52 ) 0 (m31 m32 ) (m51 m52 ) 0 (m 41 m 42 ) (m51 m52 ) 0 160 140 120 m22 m11 m31 m32 m23 m12 m13 1 m51 m41 m52 m42 m53 m43 m33 4 3 2 Factor A Levels 5 These four linear comparisons tested simultaneously is equivalent to testing that the profile line for level 1 of B is parallel to the profile line for level 2 of B. Four more similar contrasts would be needed to test the profile line for level 1 of B to that of level 3 of B. 22-22 Model for Interaction yijk m + i + j + ij + ijk m11 m12 ( m + 1 + 1 + 11 ) ( m + 1 + 2 + 12 ) ( 1 2 ) + (11 12 ) Tests for interaction are based on the abij terms exclusively. H 0 : (m11 m12 ) ( m 21 m 22 ) (11 12 ) (21 22 ) 0 If all abij terms are equal to zero, then there is no interaction. 22-23 Overall Test for Interaction SSAB SSCells SSA SSB 2 n ( yij yi y j + y ) a b i 1 j 1 1 a b 2 G2 Tij SSA SSB n i 1 j 1 abn H0: No interaction, SSAB TS: RR: F HA: Interaction exists. (a 1)(b 1) MSAB MSE MSE F > F(a-1)(b-1),ab(n-1),a 22-24 Partitioning of Total Sums of Squares TSS = SSR + SSE = SSA + SSB + SSAB + SSE ANOVA Table Source df Between Cells ab-1 Factor A a-1 Factor B b-1 Interaction (a-1)(b-1) Error(Within Cells) Total (corrected) ab(n-1) abn-1 SS SSCells SSA SSB SSAB MS MSCells MSA MSB MSAB SSE TSS MSE F MSCells/MSE MSA/MSE MSB/MSE MSAB/MSE 22-25 Multiple Comparisons in Factorial Experiments • • Methods are the same as in the one-way classification situation i.e. composition of yardstick. Just need to remember to use: (i) MSE and df error from the SSE entry in AOV table; (ii) n is the number of replicates that go into forming the sample means being compared; (iii) t in Tukey’s HSD method is # of level means being compared. Significant interactions can affect how multiple comparisons are performed. If Main Effects are significant AND Interactions are NOT significant: Use multiple comparisons on factor main effects (factor means). If Interactions ARE significant: 1) Multiple comparisons on main effect level means should NOT be done as they are meaningless. 2) Should instead perform multiple comparisons among all factorial means of interest. 22-26 Two Factor Factorial Example: pesticides and fruit trees (Example 14.6 in Ott & Longnecker, p.896) An experiment was conducted to determine the effect of 4 different pesticides (factor A) on the yield of fruit from 3 different varieties of a citrus tree (factor B). 8 trees from each variety were randomly selected; the 4 pesticides were applied to 2 trees of each variety. Yields (bushels/tree) obtained were: Pesticide (A) Variety (B) 1 2 3 1 49, 39 50, 55 43, 38 53, 48 2 55, 41 67, 58 53, 42 85, 73 3 66, 68 85, 92 69, 62 85, 99 4 This is a completely randomized 3 4 factorial experiment with factor A at a=4 levels, and factor B at b=3 levels. There are t=34=12 treatments, each replicated n=2 times. 22-27 Example in Minitab Stat > ANOVA > Two-way… Two-way ANOVA: yield versus A, B Analysis of Variance for yield Source DF SS MS F P A 3 2227.5 742.5 17.56 0.000 B 2 3996.1 1998.0 47.24 0.000 Interaction 6 456.9 76.2 1.80 0.182 Error 12 507.5 42.3 Total 23 7188.0 Interaction not significant; refit additive model: Stat > ANOVA > Two-way > additive model Two-way ANOVA: yield versus A, B Source A B Error Total DF 3 2 18 23 SS 2227.46 3996.08 964.42 7187.96 MS 742.49 1998.04 53.58 F 13.86 37.29 P 0.000 0.000 A 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 B 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 yield 49 39 55 41 66 68 50 55 67 58 85 92 43 38 53 42 69 62 53 48 85 73 85 99 S = 7.320 R-Sq = 86.58% R-Sq(adj) = 82.86% 22-28 Analyze Main Effects with Tukey’s HSD (MTB) Stat > ANOVA > General Linear Model Use to get factor or profile plots MTB will use t=4 & n=6 to compare A main effects, and t=3 & n=8 to compare B main effects. 22-29 Tukey Analysis of Main Effects (MTB) A = 1 subtracted from: Difference SE of A of Means Difference T-Value 2 14.833 4.226 3.5100 3 -1.833 4.226 -0.4338 4 20.833 4.226 4.9297 Adjusted P-Value 0.0122 0.9719 0.0006 A = 2 subtracted from: Difference SE of Adjusted A of Means Difference T-Value P-Value 3 -16.67 4.226 -3.944 0.0048 4 6.00 4.226 1.420 0.5038 A = 3 subtracted from: Difference SE of Adjusted A of Means Difference T-Value P-Value 4 22.67 4.226 5.364 0.0002 All Pairwise Comparisons among Levels of B B = 1 subtracted from: Difference SE of Adjusted B of Means Difference T-Value P-Value 2 12.38 3.660 3.381 0.0089 3 31.38 3.660 8.573 0.0000 B = 2 subtracted from: Difference SE of Adjusted B of Means Difference T-Value P-Value 3 19.00 3.660 5.191 0.0002 Summary: Summary: A3 A1 A2 A4 B1 B2 B3 22-30 Compare All Level Means with Tukey’s HSD (MTB) If the interaction had been significant, we would then compare all level means… MTB will use t=4*3=12 & n=2 to compare all level combinations of A with B. 22-31 Tukey Comparison of All Level Means (MTB) A = 1, B = 1 subtracted from: Difference SE of A B of Means Difference T-Value 1 2 4.000 6.503 0.6151 1 3 23.000 6.503 3.5367 2 1 8.500 6.503 1.3070 2 2 18.500 6.503 2.8448 2 3 44.500 6.503 6.8428 3 1 -3.500 6.503 -0.5382 3 2 3.500 6.503 0.5382 3 3 21.500 6.503 3.3061 4 1 6.500 6.503 0.9995 4 2 35.000 6.503 5.3820 4 3 48.000 6.503 7.3810 Adjusted P-Value 0.9999 0.0983 0.9623 0.2695 0.0007 1.0000 1.0000 0.1395 0.9945 0.0055 0.0003 ... etc. ... A = 4, B = 2 subtracted from: Difference SE of A B of Means Difference T-Value 4 3 13.00 6.503 1.999 Adjusted P-Value 0.6882 There are a total of t(t-1)/2=12(11)/2=66 pairwise comparisons here! Note that if we wanted just the comparisons among levels of B (within each level of A), we should use t=3 & n=2. (Not possible in MTB.) 22-32 Example in R ANOVA Table: Model with interaction > fruit <- read.table("fruit.txt",header=T) > fruit.lm <- lm(yield~factor(A)+factor(B)+factor(A)*factor(B),data=fruit) > anova(fruit.lm) Df Sum Sq Mean Sq F value Pr(>F) factor(A) 3 2227.5 742.5 17.5563 0.0001098 *** factor(B) 2 3996.1 1998.0 47.2443 2.048e-06 *** factor(A):factor(B) 6 456.9 76.2 1.8007 0.1816844 Residuals 12 507.5 42.3 Main Effects: Interaction is not significant so fit additive model > summary(lm(yield~factor(A)+factor(B),data=fruit)) Call: lm(formula = yield ~ factor(A) + factor(B), data = fruit) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 38.417 3.660 10.497 4.21e-09 *** factor(A)2 14.833 4.226 3.510 0.002501 ** factor(A)3 -1.833 4.226 -0.434 0.669577 factor(A)4 20.833 4.226 4.930 0.000108 *** factor(B)2 12.375 3.660 3.381 0.003327 ** factor(B)3 31.375 3.660 8.573 9.03e-08 *** mˆ11 38.417 mˆ 38.417 + 14.833 21 mˆ 31 38.417 1.833 mˆ12 38.417 + 12.375 22-33 Profile Plot for the Example (R) interaction.plot(fruit$A,fruit$B,fruit$yield) Averaging the 2 reps, in each A,B combination gives a typical point on the graph: yij Level 3, Factor B Level 2, Factor B Level 1, Factor B 22-34 Pesticides and Fruit Trees Example in RCBD Layout Suppose now that the two replicates per treatment in the experiment were obtained at different locations (Farm 1, Farm 2). Pesticide (A) Variety (B) 1 2 3 1 49, 39 50, 55 43, 38 53, 48 2 55, 41 67, 58 53, 42 85, 73 3 66, 68 85, 92 69, 62 85, 99 4 This is now a 3 4 factorial experiment in a randomized complete block design layout with factor A at 4 levels, factor B at 3 levels, and the location (block) factor at 2 levels. (There are still t=34=12 treatments.) The analysis would therefore proceed as in a 3-way ANOVA. 22-35