Twoway ANOVA Introduction to Factorial Designs and their

  • Slides: 41
Download presentation
Two-way ANOVA Introduction to Factorial Designs and their Analysis

Two-way ANOVA Introduction to Factorial Designs and their Analysis

Two-Way ANOVA Data Layout Factor A 1 2 : a 1 X 11 n

Two-Way ANOVA Data Layout Factor A 1 2 : a 1 X 11 n X 211 X 21 n : Xa 11 Xa 1 n Factor B 2. . . X 121. . . X 12 n. . . X 221. . . X 22 n. . . : : Xa 21. . . Xa 2 n. . . b X 1 b 1 X 1 bn X 2 b 1 X 2 bn : Xab 1 Xabn Observation k in each cell Xijk Level i Factor A There a X b treatment combinations Level j Factor B i = 1, …, a j = 1, …, b k = 1, …, n

Motivating Example: Capsule Dissolve Time Suppose are looking at two capsule types (C or

Motivating Example: Capsule Dissolve Time Suppose are looking at two capsule types (C or V) & two digestive fluids (Gastric or Duodenal) Randomly assign 5 capsules of each type to each of type of digestive juice and observe dissolve time. Xijk = measured dissolve time for capsule k in digestive juice i and capsule type j. i = 1 or 2 (i. e. G and D) j = 1 or 2 (i. e. C and V) k = 1, 2, 3, 4, 5

Questions of Interest What effect does capsule type have on the time to dissolve?

Questions of Interest What effect does capsule type have on the time to dissolve? What effect does fluid type have on the time to dissolve? Do both capsule types dissolve in the same manner in the two different fluid types?

Time Until Bubbles (seconds) Plotting the Results ~ Capsule Effect Capsule Type There appears

Time Until Bubbles (seconds) Plotting the Results ~ Capsule Effect Capsule Type There appears to be very little difference between the capsule types in terms of the time it takes them to dissolve.

Plotting the Results ~ Fluid Effect Fluid Type Capsules take 5. 5 seconds longer

Plotting the Results ~ Fluid Effect Fluid Type Capsules take 5. 5 seconds longer on average to dissolve in gastric juice compared to duodenal juice.

Preliminary Conclusion There is very little difference between the capsule types in terms of

Preliminary Conclusion There is very little difference between the capsule types in terms of the length it time it takes them to dissolve. Capsules take about 5 seconds longer on average to dissolve in gastric juice than in duodenal juice. THESE CONCLUSIONS ARE COMPLETELY WRONG!! WHY ? !?

Plotting the Results ~ Capsule Effect Separately Type C capsules dissolve faster in duodenal

Plotting the Results ~ Capsule Effect Separately Type C capsules dissolve faster in duodenal juice than do type V capsules where for gastric juice the opposite is true. Clearly the time to dissolve depends on what capsule is being used and which juice it is being dissolved in.

Interactions Type C capsules dissolve The capsule study is an example of situation faster

Interactions Type C capsules dissolve The capsule study is an example of situation faster between than Type V the in where there is an interaction duodenal juice, where two factors being studied in terms of their opposite is true when gastric juice is used to effect on the numeric response. dissolve the capsules. An interaction occurs when the effect of one factor depends on the level of another factor. Here the effect of capsule depends on the type of digestive juice used to dissolve it and vise versa.

Interactions can “mask” main effects We say the interaction masks the main effect of

Interactions can “mask” main effects We say the interaction masks the main effect of capsule type. The apparent lack of a capsule effect is caused by the interaction of capsule type and fluid type.

Types of Interactions and Interpreting Interaction Plots Here the mean response is the same

Types of Interactions and Interpreting Interaction Plots Here the mean response is the same for both levels of both factors. Here both effects are masked by the interaction. This type of interaction is called a “difference in direction” of the effects.

Types of Interactions and Interpreting Interaction Plots Here the mean response differs depending on

Types of Interactions and Interpreting Interaction Plots Here the mean response differs depending on the level of B but not A. Here the A main effect is “masked” by the interaction. The B main effect is significant, although cannot be talked about independently of the level of A.

Types of Interactions and Interpreting Interaction Plots Here the effect of A is the

Types of Interactions and Interpreting Interaction Plots Here the effect of A is the same for both levels of B. There is minimal separation between the two profiles for the levels of B, thus B is not significant Here the A main effect is differs depending on the level of B. The B main effect is masked by the interaction as the means for B 1 and B 2 are the same.

Types of Interactions and Interpreting Interaction Plots This type of interaction is a difference

Types of Interactions and Interpreting Interaction Plots This type of interaction is a difference in magnitude the effect. The direction of A main effect is the same for both levels of B, however the A effect is larger when B is at the 1 st level. Here the effect of A is the same for both levels of B and vise versa. The response differs across the level of both factors and both differences suggest significant A & B effects. Here the A main effect is differs depending on the level of B. Neither the A or B main effects are masked by the interaction.

Types of Interactions In summary there are types of interactions: Differences in Direction Differences

Types of Interactions In summary there are types of interactions: Differences in Direction Differences in Magnitude Always construct an interaction plot to visualize the interaction or lack thereof !

Questions of Interest Generally, the questions of interest here (i. e. hypotheses to be

Questions of Interest Generally, the questions of interest here (i. e. hypotheses to be tested) concern three questions regarding the potential effects of the factors on the response variable. Question 1: Do the effects that factors A and B have on the response variable interact, i. e. is there a significant interaction between factors A and B ?

Questions of Interest If we conclude there is a significant interaction then we conclude

Questions of Interest If we conclude there is a significant interaction then we conclude the effects of both factors A and B are significant! When we have an interaction we cannot consider the effect of either factor independently of the other, therefore both factors matter.

Questions of Interest If there is not a significant interaction effect then we can

Questions of Interest If there is not a significant interaction effect then we can consider the main effects separately, i. e. we ask the following: Question 2: Does factor A alone have a significant effect? Question 3: Does factor B alone have a significant effect?

Tests of Hypotheses Just as we had Sums of Squares and Mean Squares in

Tests of Hypotheses Just as we had Sums of Squares and Mean Squares in One-way ANOVA, we have the same in Two-way ANOVA: Recall, Mean Squares are measures of variability across the levels of the relevant factor of interest. In balanced Two-way ANOVA, we measure the overall variability in the data by:

Tests of Hypotheses Sum of Squares for factor A Measures variation in the response

Tests of Hypotheses Sum of Squares for factor A Measures variation in the response due to the fact that different levels of factor A were used. Sum of Squares for factor B Measures variation in the response due to the fact that different levels of factor B were used.

Test of Hypotheses Interaction Sum of Squares Measures the variation in the response due

Test of Hypotheses Interaction Sum of Squares Measures the variation in the response due to the interaction between factors A and B. If the interaction plot is perfectly parallel this will be 0! Error or Residual Sum of Squares Measures the variation in the response within the a x b factor combinations.

Tests of Hypotheses So the Two-way ANOVA Identity is: This partitions the Total Sum

Tests of Hypotheses So the Two-way ANOVA Identity is: This partitions the Total Sum of Squares into four pieces of interest for our hypotheses to be tested.

Tests of Hypotheses As in One-way ANOVA, we obtain mean squares for the different

Tests of Hypotheses As in One-way ANOVA, we obtain mean squares for the different effects by dividing the sums of squares by their respective degrees of freedom i. e. These are our measures of variance for the analysis. If an effect is not significant we expect and if it is we expect

Test of Hypotheses F-Statistic for Testing an Effect Numerator df = dfeffect Denominator df

Test of Hypotheses F-Statistic for Testing an Effect Numerator df = dfeffect Denominator df = dferror If the F-statistic is large we reject that the effect is “zero” in favor of the alternative that the effect of the factor is non-zero.

Two-way ANOVA Table Source of Degrees of Variation Freedom Sum of Squares Mean Square

Two-way ANOVA Table Source of Degrees of Variation Freedom Sum of Squares Mean Square F-ratio P-value Factor A a-1 SSA MSA FA = MSA / MSE Tail area Factor B b-1 SSB MSB FB = MSB / MSE Tail area Interaction (a – 1)(b – 1) SSAB MSAB FAB = MSAB / MSE Tail area Error ab(n – 1) SSE MSE Total abn - 1 SST This is our initial focus which is the p-value for Question 1: Is there an interaction effect?

Tests of Hypotheses If the interaction is not statistically significant (i. e. p-value >

Tests of Hypotheses If the interaction is not statistically significant (i. e. p-value > 0. 05) then we conclude the main effects (if present) are independent of one another. We can then test for significance of the main effects separately, again using an F-test. If a main effect is significant we can then use multiple comparison procedures as usual to compare the mean response for different levels of the factor while holding the other

Tests of Hypotheses If an interaction is significant (p-value <. 05) we conclude the

Tests of Hypotheses If an interaction is significant (p-value <. 05) we conclude the main effects are not independent of one another and that both effects are important! In this case (i. e. the interaction is significant) the tests for main effects in the Two-way ANOVA table are MEANINGLESS! We must compare levels of factor A within each level of factor B (and vise versa).

Example 1: Capsule Dissolve Time Enter the n = 5 replicates for each treatment

Example 1: Capsule Dissolve Time Enter the n = 5 replicates for each treatment combination: Gastric, C Gastric, V Duodenal, C Duodenal, V

Example 1: Capsule Dissolve Time Then click Run Model leaving everything else unchanged. 1

Example 1: Capsule Dissolve Time Then click Run Model leaving everything else unchanged. 1 st Highlight both factors in this list. Next highlight Full Factorial from the Macros pull-down menu.

Example 1: Capsule Dissolve Time Lots of extra CRAP we don’t need. Turn off

Example 1: Capsule Dissolve Time Lots of extra CRAP we don’t need. Turn off the plots as they are unnecessary when considering two-way ANOVA. Also we really only need to consider the Effect Tests portion of the numeric output initially.

Example 1: Capsule Dissolve Time Interaction effect is statistically significant (p =. 0049). Therefore

Example 1: Capsule Dissolve Time Interaction effect is statistically significant (p =. 0049). Therefore we conclude that both the capsule and fluid type effects are significant, however we cannot talk about their effects in term of the mean time until bubbles are observed independently. We can compare capsule effects for the same fluid type or fluid effects for the same capsule type.

Capsule x Fluid Type Interaction Because the interaction is statistically significant we are interested

Capsule x Fluid Type Interaction Because the interaction is statistically significant we are interested in comparing fluid types for a given capsule type or Treatment comparing capsules for a given fluid type. combination means. The table on the right contains the results of all pair-wise treatment mean comparisons, however we are only interested in those as described above. Here we find that there is a significant difference in the fluid types for the type C capsules however there are no significant Interaction Plot differences between the capsules themselves for given fluid type, nor is there a fluid effect when dissolving type V capsules. We estimate that the mean time to dissolve type C capsules in gastric fluid is between 3. 57 and 23. 43 minutes larger than the mean for duodenal.

Checking Assumptions To check the assumptions of normality of the response and equality of

Checking Assumptions To check the assumptions of normality of the response and equality of variance for the difference treatment combinations we can examine the residuals. For a two-way ANOVA the residuals are the deviations of the observations from their respective treatment combination sample means, i. e.

Checking Assumptions To check the assumption of normality, assess the normality of the residuals

Checking Assumptions To check the assumption of normality, assess the normality of the residuals The residuals from the capsule experiment look approximately normal with the exception of two outliers, but neither are extreme enough to warrant any concerns.

Checking Assumptions To check the equality of variance for the difference treatment combinations we

Checking Assumptions To check the equality of variance for the difference treatment combinations we can examine the residuals plotted vs. the different treatment combination means There appears to be more variation for the dissolve times for type C capsules being dissolved in gastric fluid. These combination produced the two mild outliers seen in the normal quantile plot. Generally we worry when the variation increases with the treatment combination mean.

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Suppose

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Suppose that a clinical psychologist is interested in comparing the relative effectiveness of three forms of psychotherapy for alleviating depression. Fifteen individuals are randomly assigned to each of three treatment groups: cognitive-behavioral, Rogerian, and assertiveness training. The Depression Scale of MMPI serves as the response. The psychologist also wished to incorporate information about the patient’s severity of depression, so all subjects in the study were classified as having mild, moderate, or severe depression. Thus we have two factor of interest in this study: the treatment they received and the initial severity of their depression.

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Interaction

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Interaction Plot Therapy Effect Plot Degree of Severity Effect Plot

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Is

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Is there a significant interaction effect ? NO, p =. 9717 Is there a significant therapy effect ? YES, p =. 0356 Is there a significant degree of severity of effect ? YES, p <. 0001 Now we can conduct multiple comparisons on each factor separately.

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression We

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression We see that Rogerian therapy differs significantly from Cognitive-Behavioral therapy, with Rogerian having larger mean by between. 8 and 9. 87 units. We see that the initial severity of depression levels significantly differ from each other in terms of mean depression score. In particular we see that those with a severe classification have a mean depression score exceeding that for those with mild depression by between 8 and 18 points and those with moderate depression by between 2 and 11. 5 points.

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Residuals

Example 2: Comparing the Effectiveness of Three Forms of Psychotherapy for Alleviating Depression Residuals look approximately normal. Residuals indicate constant variation within each treatment combination.

Summary • These ideas can be extended to more than two factors. • When

Summary • These ideas can be extended to more than two factors. • When interactions exist, the main effects are involved are important, but cannot discussed separately. • Multiple comparisons can still be conducted to compare different treatment level means.