1 Topic 11 – ANOVA II Balanced Two-Way ANOVA (Chapter 19)

Slides:



Advertisements
Similar presentations
1 COMM 301: Empirical Research in Communication Lecture 15 – Hypothesis Testing Kwan M Lee.
Advertisements

Statistical Techniques I EXST7005 Multiple Regression.
Topic 12 – Further Topics in ANOVA
BPS - 5th Ed. Chapter 241 One-Way Analysis of Variance: Comparing Several Means.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 21, Slide 1 Chapter 21 Comparing Two Proportions.
1 Chapter 4 Experiments with Blocking Factors The Randomized Complete Block Design Nuisance factor: a design factor that probably has an effect.
Dr George Sandamas Room TG60
EPIDEMIOLOGY AND BIOSTATISTICS DEPT Esimating Population Value with Hypothesis Testing.
BCOR 1020 Business Statistics
Mean Comparison With More Than Two Groups
Incomplete Block Designs
Inferences About Process Quality
Single Factor Analysis of Variance
1 1 Slide © 2003 South-Western/Thomson Learning™ Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
Basic Analysis of Variance and the General Linear Model Psy 420 Andrew Ainsworth.
Inferential Statistics
Understanding the Two-Way Analysis of Variance
Chapter 12: Analysis of Variance
F-Test ( ANOVA ) & Two-Way ANOVA
McGraw-Hill/IrwinCopyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 9 Hypothesis Testing.
Topic 28: Unequal Replication in Two-Way ANOVA. Outline Two-way ANOVA with unequal numbers of observations in the cells –Data and model –Regression approach.
1 Experimental Statistics - week 7 Chapter 15: Factorial Models (15.5) Chapter 17: Random Effects Models.
Analysis of Variance or ANOVA. In ANOVA, we are interested in comparing the means of different populations (usually more than 2 populations). Since this.
Stats Lunch: Day 7 One-Way ANOVA. Basic Steps of Calculating an ANOVA M = 3 M = 6 M = 10 Remember, there are 2 ways to estimate pop. variance in ANOVA:
Comparing Two Proportions
23-1 Analysis of Covariance (Chapter 16) A procedure for comparing treatment means that incorporates information on a quantitative explanatory variable,
 The idea of ANOVA  Comparing several means  The problem of multiple comparisons  The ANOVA F test 1.
© Copyright McGraw-Hill CHAPTER 12 Analysis of Variance (ANOVA)
Two-way ANOVA Introduction to Factorial Designs and their Analysis.
CHAPTER 12 Analysis of Variance Tests
ANOVA (Analysis of Variance) by Aziza Munir
1 Chapter 13 Analysis of Variance. 2 Chapter Outline  An introduction to experimental design and analysis of variance  Analysis of Variance and the.
Copyright © 2004 Pearson Education, Inc.
Testing Hypotheses about Differences among Several Means.
Parametric tests (independent t- test and paired t-test & ANOVA) Dr. Omar Al Jadaan.
Chapter 14 – 1 Chapter 14: Analysis of Variance Understanding Analysis of Variance The Structure of Hypothesis Testing with ANOVA Decomposition of SST.
Chapter 10: Analyzing Experimental Data Inferential statistics are used to determine whether the independent variable had an effect on the dependent variance.
Analysis of Variance 1 Dr. Mohammed Alahmed Ph.D. in BioStatistics (011)
1 Chapter 9 Hypothesis Testing. 2 Chapter Outline  Developing Null and Alternative Hypothesis  Type I and Type II Errors  Population Mean: Known 
Copyright © 2010 Pearson Education, Inc. Chapter 22 Comparing Two Proportions.
Two-Sample Hypothesis Testing. Suppose you want to know if two populations have the same mean or, equivalently, if the difference between the population.
Chapter 14 – 1 Chapter 14: Analysis of Variance Understanding Analysis of Variance The Structure of Hypothesis Testing with ANOVA Decomposition of SST.
Multiple Regression I 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 4 Multiple Regression Analysis (Part 1) Terry Dielman.
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
CHAPTER 27: One-Way Analysis of Variance: Comparing Several Means
Topic 20: Single Factor Analysis of Variance. Outline Analysis of Variance –One set of treatments (i.e., single factor) Cell means model Factor effects.
Hypothesis test flow chart frequency data Measurement scale number of variables 1 basic χ 2 test (19.5) Table I χ 2 test for independence (19.9) Table.
McGraw-Hill, Bluman, 7th ed., Chapter 12
One-Way Analysis of Variance Recapitulation Recapitulation 1. Comparing differences among three or more subsamples requires a different statistical test.
Topic 22: Inference. Outline Review One-way ANOVA Inference for means Differences in cell means Contrasts.
Significance Tests for Regression Analysis. A. Testing the Significance of Regression Models The first important significance test is for the regression.
Statistics (cont.) Psych 231: Research Methods in Psychology.
ANOVA and Multiple Comparison Tests
1 Topic 14 – Experimental Design Crossover Nested Factors Repeated Measures.
Factorial BG ANOVA Psy 420 Ainsworth. Topics in Factorial Designs Factorial? Crossing and Nesting Assumptions Analysis Traditional and Regression Approaches.
Slide Slide 1 Copyright © 2007 Pearson Education, Inc Publishing as Pearson Addison-Wesley. Lecture Slides Elementary Statistics Tenth Edition and the.
Slide 1 Copyright © 2004 Pearson Education, Inc. Chapter 11 Multinomial Experiments and Contingency Tables 11-1 Overview 11-2 Multinomial Experiments:
Chapter 10: The t Test For Two Independent Samples.
Lecture notes 13: ANOVA (a.k.a. Analysis of Variance)
Comparing Two Proportions
Two-Sample Hypothesis Testing
Lecture Slides Elementary Statistics Twelfth Edition
Factorial Experiments
Comparing Three or More Means
Comparing Two Proportions
Chapter 9 Hypothesis Testing.
Comparing Two Proportions
Psych 231: Research Methods in Psychology
Chapter 10 – Part II Analysis of Variance
F test for Lack of Fit The lack of fit test..
Presentation transcript:

1 Topic 11 – ANOVA II Balanced Two-Way ANOVA (Chapter 19)

2 Two Way ANOVA We are now interested the combined effects of two factors, A and B, on a response (note: text refers to these as R = rows and C = columns – we’ll call them A, B, and later C for a 3-way ANOVA). Examples:  Want to consider the effects of diet plan (Factor A) and exercise program (Factor B) on weight.  Want to consider the effects of a drug (Factor A) and a vitamin tablet (Factor B) on blood pressure.

3 Two Way ANOVA (2) Interested in a combination of the two factors; unlike blocking, both of primary interest. Could treat each combination of factors as a treatment and do one-way ANOVA, but then you have to use contrasts a lot in order to tests hypotheses of interest.

4 Two Way ANOVA (3) Interaction is a possibility. Replication is required to investigate interaction. You generally want at least two observations per treatment combination. You also generally want a balanced design (for this topic, we’ll assume cell sizes are equal).

5 Example (Problem 19.1) An animal experiment is designed to investigate whether the drug Levorphanol reduces stress as reflected in the cortical sterone level. It is also likely that Epinephrine (adrenaline) levels have some effect and there may be an interaction with the drug effect as well. Some animals were given a drug that raised their normal levels of Epinephrine.

6 Example (2) ControlLevorphanolEpinephrineBoth

7 Example (3) If we treat this as one-way ANOVA (which is not ideal in real life but useful here for instructional purposes), then we can design contrasts can be used to investigate the effects: ComparisonCLEB L effect E effect Interaction

8 SAS Code (one-way)

9 SAS Output

10 Notes The three contrasts have a special property – they are “orthogonal”. Their sum is actually the model SS: = We see that there are distinguishable effects for both drugs, plus an interaction (F-tests). A significant interaction means that the size of the L effect is different at different levels of E (or equivalently, the size of the E effect is different for different levels of L); more later.

11 Two-Way ANOVA Break up the treatments into two factors. Factor 1: Levorphanol (Present / Absent) Factor 2: Epinephrine (High / Low) Investigates all combinations of the two factors Ep. Lev.LowHigh Absentxxxxx Presentxxxxx

12 Two-Way ANOVA (2) Rows / Columns of table represent levels of the factors. We have 5 observations at each combination of levels. Another way to view the design:

13 Output from interaction model Note: Type III SS will be the same, since balanced design.

14 Statistical Model a levels of Factor A; b levels of Factor B n observations per cell, so the total number of observations is nab. Usual basic assumptions: Independent & Normal Errors with Constant Variance.

15 Statistical Model (2)

16 Statistical Model (3) As before we think of all the effects in terms of deviation from the grand (overall) mean. We need parameter restrictions: SAS does things slightly differently – making mu the mean for the last treatment combination (labeled ab ), and setting any parameter with one of those levels to zero.

17 Statistical Model (4) Original ANOVA table (SAS) will have an “overall” F-test.  Simply tests whether ANY of the factors are significant.  Not particularly useful (unless insignificant) as it doesn’t differentiate between the factors. Because of this, we usually create an “extended” ANOVA table by replacing the model line with the Type I SS.

18 Analysis of Variance Table SourceDFSSMSF0F0 Factor ASSAMSAMSA/MSE Factor BSSBMSBMSB/MSE AB Interaction SSABMSABMSAB/MSE ErrorSSEMSE TotalSST

19 Replication Recall that RCBD typically has n = 1.  Notice what happens in the ANOVA table if we have n = 1.  In this case, we will not be able to investigate interaction as the DF for error would be zero (interaction and error effects would be confounded, or inseparable – a different type of “confounding” than we discussed last time). We need at least two replicates in order to assess interaction.

20 Breakdown of SS As before, don’t worry too much about the formulas in the book. Do remember:  SSModel + SSError = SSTotal  SSModel gets broken down via the Type I SS  For balanced design, Type III SS will all be the same as Type I SS. Balanced designs are to be preferred.  Know other relationships within the ANOVA table and how to put together test statistics.

21 Tests There is a specific order in which you need to do the tests.  General Rule of Thumb: Test higher order terms first.  If higher order terms are significant (say AB interaction), then tests for lower order terms (A and B main effects) do not matter as much.  Why?

22 Test for Interaction F-statistic: Hypotheses If then reject H 0. If insignificant, then can test for main effects.

23 Test for Main Effect Factor A F-statistic: Hypotheses If then reject H 0

24 Test for Main Effect Factor B F-statistic: Hypotheses If then reject H 0.

25 Comparing Factors / Levels If there is an interaction – you must do comparisons for one factor at each level of the other factor. (More later) If a main effect tests significant (whether or not there is interaction), you can study the main effect by averaging over all levels of the other factor.  This will be most meaningful if there truly is no interaction; when interaction is present, still best to study it first.

26 Basic SAS Code Bar notation in model statement tells SAS to include all combined effects (all main effects and all interactions) for the factors involved. Alternatively could do E L E*L; which may be important if you don’t want all interactions in a model.

27 Output from interaction model Note: Type III SS will be the same, since balanced design.

28 Create “Extended” Table The Type I SS lines replace the model line. This makes it easy to see not only that there are significant effects, but which effects in particular are important.

29 Where next? Interaction is significant, so we will want to study that. Because main effects are also significant, we will be able to distinguish them to some extent from the interaction.  Our statements about the main effects, however, will be less useful than they would be if there were no interaction.

30 Computing main the effects The means for each combination are Compare Levorphanol (average out epin.) Low EHigh E L Absent L Present

31 Main Effects (2) Adding L results in a significant decrease in stress levels for the animals. Compare Epinephrine (average out lev.) Higher levels of E result in significant increases in the stress levels.

32 Interaction What about the interaction?  Difference in effect of L between low E and high E: This says that the effect size for the use of L is much larger when E levels are high. You get a greater reduction in stress (or more bang for your buck).

33 Interaction (2) You could go the other way and consider:  Difference in effect of E when L is used (vs. not used): Interpretation: The effect size for having higher levels of E is smaller when the drug L is used.

34 Conclusions Higher levels of E result in greater stress (as we might expect). The drug L seems to effectively lower stress levels regardless of E levels. But it works more efficiently at higher levels of E and lowers stress levels by a greater amount.

35 Interactions When there is significant interaction, the key to the analysis is studying the interaction and interpreting it.

36 Interaction Plots Two choices:  Plot MEAN Response vs. Factor B by Factor A  Plot MEAN Response vs. Factor A by Factor B Possible outcomes include  Main Effects but No Interaction  One Main Effect but No Interaction  Same Direction Interaction (as in example; increase or decrease, but not by same amount)  Reverse Interaction  See Section

37 Interaction Plots We’ll now take a look at a number of 2 x 2 interaction plots to get an idea of what to look for. Once you learn to look at the plots, you will be able to:  Determine if interaction is present  Estimate effect sizes from the plots

38 Interaction Plots (1) Main Effects, No Interaction

39 Interaction Plots (2) Only Factor A Main Effect

40 Interaction Plots (3) Decreasing A effect, but not by same amt.

41 Interaction Plots (4) Reverse Interaction (Main effects likely appear insignificant due to the interaction)

42 Key to Interpretation If interaction is present, then the effect of one factor depends on the level of the other factor.  Hence main effects carry explicit meaning only if we have no interaction.  If opposite behavior (as on the previous slide), main effect might be cancelled out by the interaction and appear insignificant. When interaction is present, you need to discuss the effect of each variable at a specific level of the other (cannot separate).

43 Example We return to our example  Difference in effect of L based on E = high or low: Can we test for significance?  Need to develop standard errors.

44 Example (2) From ANOVA table, MSE = on 16 degrees of freedom. For any two-sided t-test, the critical value for significance level 0.05 will be For E = low, the estimated L effect is (see previous slide). The standard error for that difference would be So T = / = We conclude that the L effect is not significantly different from 0 for low E. For E = high, estimated effect of L is with SE of Hence T = and we conclude that the L effect is a significant decrease for high E.

45 Obtaining these tests from SAS First note that the minor calculations we’ve done in the notes you should be able to put together by hand. In SAS, we’ll use the LSMEANS statement in PROC GLM, and can get all the numbers we have computed. New: As an option in LSMeans for the interaction A*B, use SLICE = to obtain tests for the significance of Factor A at fixed levels of Factor B.

46 SAS Code

47 Studying Interaction Recall: Since the interaction was significant, we must study this data at the interaction level.  We were able to examine main effects (also significant), but that analysis must be taken with a grain of salt (you’ll see why in a moment). Our LSMEANS statement will produce output for the L effect at each level of E.

48 Basic LSMeans Output

49 L Effect sliced by E levels Conclusions  If the epinephrine level is high, then the drug is effective.  But if the epinephrine level is low, the drug doesn’t do anything that is statistically significant.

50 Could “slice” on Levorphanol Conclusions  If the drug is not used, higher epinephrine levels result in a significant stress level increase.  If the drug is used, then higher epinephrine levels don’t change the stress level significantly.

51 Conclusions Even though the main effects are “significant” – the presence of interaction means we must talk about the combined effects (as on the previous two slides). The conclusions based on main effects would be inaccurate.  Main: Drug is effective (wrong!)  Interaction: Drug is effective for those with high levels of epinephrine (correct!)

52 Interaction Plots Interaction plots provide another useful way to look at interaction effects. An interaction plot is a plot of the treatment means at each level of one factor for each level of the other factor. The plots are overlaid so that you wind up with a plot in which the different lines represent the different levels of the 2 nd factor.

53 Interaction Plots (2) To obtain an interaction plot: 1.Use the SORT procedure to sort the data by each treatment. 2.Use the MEANS procedure to obtain the means for each combination. 3.Use the GPLOT procedure (and associated statements) to produce the plot

54 SAS Code Note: Produces only the combined means which are the ones you actually want.

55 Output Data Set

56 Alternative Code (class stmt) Note: Produces means for individual variables as well as combinations.

57 Output Data Set (class stmt)

58 Interesting Tidbit Means from CLASS statement can be used to produce effect sizes (which you should be able to calculate as we did in 1-way ANOVA).

59 Plotting the Combined Means

60 Interaction Plot

61 Conclusions (as before) Higher levels of epinephrine increase stress levels. Levorphenol brings stress levels back into normal range. (It is not effective for anything if stress levels are already normal). Levorphenol appears to be useful in animals with abnormally high stress levels.

62 CLG Activity Examine some interaction plots. Perform a two-way ANOVA.