Presentation is loading. Please wait.

Presentation is loading. Please wait.

More complicated ANOVA models: two-way and repeated measures Chapter 12 Zar Chapter 11 Sokal & Rohlf First, remember your ANOVA basics……….

Similar presentations


Presentation on theme: "More complicated ANOVA models: two-way and repeated measures Chapter 12 Zar Chapter 11 Sokal & Rohlf First, remember your ANOVA basics………."— Presentation transcript:

1 More complicated ANOVA models: two-way and repeated measures Chapter 12 Zar Chapter 11 Sokal & Rohlf First, remember your ANOVA basics……….

2 0 1 2 3 4 5 6 7 8 0102030 Plot number Yield (tonnes) -Total SS in 1-way ANOVA -Deviations around total mean Fert 1 Fert 2 Fert 3 Overall mean

3 0 1 2 3 4 5 6 7 8 0102030 Plot number Yield (tonnes) Fert 1 Fert 2 Fert 3 Group means Within group SS= deviations around group means

4 0 1 2 3 4 5 6 7 8 0102030 Plot number Yield (tonnes) Fert 1 Fert 2 Fert 3 Overall mean Group means Among groups SS=deviations of group means from overall mean

5 Mean squares Combine information on SS and df Total mean squares = total SS/ total df total variance of data set Within group mean squares = within SS/ within df variance (per df) among units given same treatment Among groups mean squares = among SS / among df variance (per df) among units given different treatments Unfortunate word usage Error MS

6 Among groups mean squares Within group mean squares F =  The question: Does fitting the treatment mean explain a significant amount of variance? Compare calculated F to critical value from table (B4)

7 If calculated F as big or bigger than critical value, then reject H 0 But remember……. H0: m1 = m2 = m3 Need separate test (multiple comparison test) to tell which means differ from which

8 Factorial ANOVA= simultaneous analysis of the effect of more than one factor on population means -- Effect of light (or music) and water on plant growth -- Effect of drug treatment and gender on patient survival --Effect of turbidity and prey type on prey consumption by yellow perch --Effect of gender and income bracket on # pairs of shoes owned

9 Two-way ANOVA vs a nested (hierarchical) ANOVA see chapter 10 S& R Example: the effect of drug on quantity of skin pigment in rats. 5 drugs + 1 control= 6 groups (fixed effect) 5 rats per drug 3 skin samples per rat Each sample divided in to 2 lots, each hydrolyzed 2 optical density readings per hydrolyzed sample Random effects

10 Drug is the main factor of interest All other levels are subordinate Rat1 in drug treatment 1 is not the same as Rat1 in drug treatment 2 Above design is nested. Rats are nested within drug treatment, skin sample is nested within rat etc……. Can be mixed model (as in example) where primary effect is fixed (drug) but subordinate levels are random Or can be completely random model if the levels (eg drugs) were truly a random sample of all possible drugs

11 Two-way ANOVA, Two-factor ANOVA There must be correspondence across classes --Effect of turbidity level and prey type on prey consumption by yellow perch High and low turbidity must be the same across all prey types Turbidity could be random or fixed Prey type probably always fixed? -- Effect of drug treatment and gender on patient survival Drug treatments must be same for both genders Drug could be random or fixed Gender always fixed?

12 Terminology --Two factors A and B -- a = number of levels of A; starting with i -- b = number of levels of B; starting with j -- n = number replicates; starting with l -- Each combination of a level of A with a level of B is called a cell -- Cell analogous to groups in 1-way ANOVA --If there are 2 levels of 2 factors analysis called 2 x 2 factorial

13 Low AHigh A Low BLow A Low B High A Low B High BLow A High B High A High B cell

14 Total SS =    (X ijl –X) 2 a i=1 b j=1 n l=1 = (all deviations from grand mean) 2 Total DF = N-1

15 Among Cell SS = variability between cell means and grand mean --among cell DF= ab-1 --Analogous to among groups SS in 1-way ANOVA Within Cell SS = deviations from each cell mean --within cell DF = ab (n-1) --analogous to within groups SS in 1-way ANOVA

16 But……. Goal of 2-way ANOVA is to assess the affects of each of the 2 factors independently of each other --Consider A to be the only factor in a 1-way ANOVA (ignore B) Factor A SS = bn  (X i –X) 2 a i=1 Then --Consider B to be the only factor in a 1-way ANOVA Factor B SS = an  (X j –X) 2 b j=1

17 Now the tricky part…………… -- Among cell variability usually  variability among levels of A + variability among levels of B -- The unaccounted for variability is due to the effect of interaction -- Interaction means that the effect of A is not independent of the presence of a particular level of B --Interaction effect is in addition to the sum of the effects of each factor considered separately

18 With zmWithout zm Low lightWith zm Low light Without zm Low light High lightWith zm High light Without zm High light Grow algae two levels of light and with and without zebra mussels, 15 reps in each cell, N=60 Measure net primary production of the algae (NPP)

19 We will now graphically examine a range of outcomes of this 2x2 factorial ANVOA Some of the possible outcomes have below. Be prepared to discuss the meaning –ie, your interpretation of the graph with your name on it.

20 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 No difference of either factor and no interaction High light Low light Erin H.

21 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 Significant main effect of light High light Low light Dave H.

22 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 Significant main effect of ZM High light Low light Jhonathon

23 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 Both main effects are significant, but no interaction High light Low light Josh S. Anthony

24 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 Significant interaction, but no significant main effect High light Low light Colin Xiao-Jain

25 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 Interaction and the main light effect are significant High light Low light Rajan Coleen

26 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 Interaction and the main zm effet are significant High light Low light Chen-Lin Nan

27 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 High light Low light the interaction and both main effects are significant Reza Malak

28 With zmWithout zm NPP (mgO2/m2/2hr) 0 10 20 High light Low light the interaction and both main effects are significant Chenxi Damien

29 How to in SAS: Data X; set Y; proc glm; class gender salary; model shoepair=gender salary gender*salary; Main effects interaction

30 Analysis of covariance (ANCOVA) -Testing for effects with one categorical and one continuous predictor variable -Testing for differences between two regressions -Some of the features of both regression and analysis of variance. -A continuous variable (the covariate) is introduced into the model of an analysis-of-variance experiment.

31 Initial assumption that there is a linear relationship between the response variable and the covariate If not, ANCOVA no advantage over simple ANOVA

32 Ex. Test of leprosy drug Variables = Drug- two antibiotics (A and D) & control (F) PreTreatment- a pre-treatment score of leprosy bacilli PostTreatment- a post-treatment score of leprosy bacilli -10 patients selected for each drug) -6 sites on each measured for leprosy bacilli. -Covariate = pretreatment score included in model for increased precision in determining the effect of drugs on the posttreatment count of bacilli.

33 data drugtest; input Drug $ PreTreatment PostTreatment @@; datalines; A 11 6 A 8 0 A 5 2 A 14 8 A 19 11 A 6 4 A 10 13 A 6 1 A 11 8 A 3 0 D 6 0 D 6 2 D 7 3 D 8 1 D 18 18 D 8 4 D 19 14 D 8 9 D 5 1 D 15 9 F 16 13 F 13 10 F 11 18 F 9 5 F 21 23 F 16 12 F 12 5 F 12 16 F 7 1 F 12 20 ; proc glm; class Drug; model PostTreatment = Drug PreTreatment Drug*PreTreatment / solution; run; Different way to read in data Define categorical variable Model dependent var=categorical variable covariate and categorical * covariate interaction

34 First, slopes must be equal to proceed with other comparisons. If interaction term significant- end of test If interaction term not significant can compare intercepts (means) SourceDFType I SSMean SquareF ValuePr > F Drug2293.6000000146.80000009.150.0010 PreTreatment1577.8974030 36.01<.0001 SourceDFType III SSMean SquareF ValuePr > F Drug268.553710634.27685532.140.1384 PreTreatment1577.8974030 36.01<.0001 ParameterEstimate Standard Errort ValuePr > |t| Intercept-0.434671164B2.47135356-0.180.8617 Drug A-3.446138280B1.88678065-1.830.0793 Drug D-3.337166948B1.85386642-1.800.0835 Drug F0.000000000B... PreTreatment0.987183811 0.164497576.00<.0001 ** use Type III SS

35 Type I SS for Drug gives the between-drug sums of squares for ANOVA model PostTreatment=Drug. Measures difference between arithmetic means of posttreatment scores for different drugs, disregarding the covariate.

36 The Type III SS for Drug gives the Drug sum of squares adjusted for the covariate. Measures differences between Drug LS-means, controlling for the covariate. The Type I test is highly significant (p=0.001), but the Type III test is not. Therefore, while there is a statistically significant difference between the arithmetic drug means, this difference is not significant when you take the pretreatment scores into account.

37


Download ppt "More complicated ANOVA models: two-way and repeated measures Chapter 12 Zar Chapter 11 Sokal & Rohlf First, remember your ANOVA basics………."

Similar presentations


Ads by Google