Two-Way Balanced Independent Samples ANOVA Computations.

41
Two-Way Balanced Independent Samples ANOVA Computations

Transcript of Two-Way Balanced Independent Samples ANOVA Computations.

Page 1: Two-Way Balanced Independent Samples ANOVA Computations.

Two-Way Balanced Independent Samples ANOVA

Computations

Page 2: Two-Way Balanced Independent Samples ANOVA Computations.

Partitioning the SStotal

• The total SS is divided into two sources– Cells or Model SS– Error SS– The model is

ijkjkkjijk eY

Page 3: Two-Way Balanced Independent Samples ANOVA Computations.

Partitioning the SScells

• The cells SS is divided into three sources– SSA, representing the main effect of factor A– SSB, representing the main effect of factor B– SSAxB, representing the A x B interaction

• These sources will be orthogonal if the design is balanced (equal sample sizes)– They sum to SScells

– Otherwise the analysis gets rather complicated.

Page 4: Two-Way Balanced Independent Samples ANOVA Computations.

Gender x Smoking History

• Cell n = 10, Y2 = 145,140

SMOKING HISTORY GENDER never < 1m 1 m - 2 y 2 y - 7 y 7 y - 12 y marginal Male 300 200 220 250 280 1,250 (25) Female 600 300 350 450 500 2,200 (44) marginal 900 (45) 500 (25) 570 (28.5) 700 (35) 780 (39) 3,450

025,119100

3450)( 22

N

YCM

115,26025,119140,1452 CMYSSTotal

Page 5: Two-Way Balanced Independent Samples ANOVA Computations.

Computing Treatment SS

Square and then sum group totals, divide by the number of scores that went into each total, then subtract the CM.

Page 6: Two-Way Balanced Independent Samples ANOVA Computations.

SScells and SSerror

SSerror is then SStotal minus SSCells = 26,115 ‑ 15,405 =

10,710.

SMOKING HISTORY GENDER never < 1m 1 m - 2 y 2 y - 7 y 7 y - 12 y marginal Male 300 200 220 250 280 1,250 (25) Female 600 300 350 450 500 2,200 (44) marginal 900 (45) 500 (25) 570 (28.5) 700 (35) 780 (39) 3,450

cellsSS

405,15

025,11910

500450350300600280250220200300 2222222222

Page 7: Two-Way Balanced Independent Samples ANOVA Computations.

SSgender and SSsmoke

SMOKING HISTORY GENDER never < 1m 1 m - 2 y 2 y - 7 y 7 y - 12 y marginal Male 300 200 220 250 280 1,250 (25) Female 600 300 350 450 500 2,200 (44) marginal 900 (45) 500 (25) 570 (28.5) 700 (35) 780 (39) 3,450

025,9025,11950

200,2250,1 22

GenderSS

140,5

025,11920

780700570500900 22222

SmokeSS

Page 8: Two-Way Balanced Independent Samples ANOVA Computations.

SSSmoke x Gender

SSinteraction = SSCells SSGender SSSmoke =

15,405 ‑ 9,025 ‑ 5,140 = 1,240.

Page 9: Two-Way Balanced Independent Samples ANOVA Computations.

Degrees of Freedom

• dftotal = N - 1

• dfA = a - 1

• dfB = b - 1

• dfAxB = (a - 1)(b -1)

• dferror = N - ab

Page 10: Two-Way Balanced Independent Samples ANOVA Computations.

Source Table

Source SS df MS F p A-gender 9025 1 9025 75.84 <.001 B-smoking history 5140 4 1285 10.80 <.001 AxB interaction 1240 4 310 2.61 .041 Error 10,710 90 119 Total 26,115 99

Page 11: Two-Way Balanced Independent Samples ANOVA Computations.

Simple Main Effects of Gender

SS Gender, never smoked

SS Gender, stopped < 1m

SS Gender, stopped 1m ‑ 2y

SMOKING HISTORY GENDER never < 1m 1 m - 2 y 2 y - 7 y 7 y - 12 y marginal Male 300 200 220 250 280 1,250 (25) Female 600 300 350 450 500 2,200 (44) marginal 900 (45) 500 (25) 570 (28.5) 700 (35) 780 (39) 3,450

500,420

900

10

600300 222

50020

500

10

300200 222

84520

570

10

350220 222

Page 12: Two-Way Balanced Independent Samples ANOVA Computations.

Simple Main Effects of Gender

SS Gender, stopped 2y - 7y

SS Gender stopped 7y ‑ 12 y

SMOKING HISTORY GENDER never < 1m 1 m - 2 y 2 y - 7 y 7 y - 12 y marginal Male 300 200 220 250 280 1,250 (25) Female 600 300 350 450 500 2,200 (44) marginal 900 (45) 500 (25) 570 (28.5) 700 (35) 780 (39) 3,450

000,220

700

10

450250 222

420,220

780

10

500280 222

Page 13: Two-Way Balanced Independent Samples ANOVA Computations.

Simple Main Effects of Gender

• MS = SS / df; F = MSeffect / MSE

• MSE from omnibus model = 119 on 90 df

Smoking History SS Gender at never < 1m 1 m - 2 y 2 y - 7 y 7 y - 12 y F(1, 90) 37.82 4.20 7.10 16.81 20.34 p <.001 .043 .009 <.001 <.001

Page 14: Two-Way Balanced Independent Samples ANOVA Computations.

Interaction Plot

< 1 m 1m - 2y 2y - 7y 7y - 12 y never10

20

30

40

50

60

70

Female

Male

Delay of Stimulation

Smoking History

Ability to Detect the Scent

Page 15: Two-Way Balanced Independent Samples ANOVA Computations.

Simple Main Effects of Smoking

• SS Smoking history for men

• SS Smoking history for women

• Smoking history had a significant simple main effect for women, F(4, 90) = 11.97, p < .001, but not for men, F(4, 90) = 1.43, p =.23.

68050

250,1

10

280250220200300 222222

700,550

200,2

10

500450350300600 222222

Page 16: Two-Way Balanced Independent Samples ANOVA Computations.

Multiple Comparisons Involving A Simple Main Effect

• Smoking had a significant simple main effect for women.

• There are 5 smoking groups.• We could make 10 pairwise comparisons.• Instead, we shall make only 4 comparisons.• We compare each group of ex-smokers with

those who never smoked.

Page 17: Two-Way Balanced Independent Samples ANOVA Computations.

Female Ex-Smokersvs. Never Smokers

• There is a special procedure to compare each treatment mean with a control group mean (Dunnett).

• I’ll use a Bonferroni procedure instead.

• The denominator for each t will be:

.0125.405. pc

8785.4)10/110/1(119

Page 18: Two-Way Balanced Independent Samples ANOVA Computations.

• http://core.ecu.edu/psyc/wuenschk/SPSS/P-SPSS.doc

Never Smoked vs Quit

8785.4)90( ji MM

t

p Significant?

< 1 m (60-30) / 4.8785=6.149 < .001 yes 1 m - 2 y (60-35) / 4.8785=5.125 < .001 yes 2 y - 7 y (60-45) / 4.8785=3.075 .0028 yes 7 y - 12 y (60-50) / 4.8785=2.050 .0433 no

Page 19: Two-Way Balanced Independent Samples ANOVA Computations.

Multiple Comparisons Involving a Main Effect

• Usually done only if the main effect is significant and not involved in any significant interaction.

• For pedagogical purposes, I shall make pairwise comparisons among the marginal means for smoking.

• Here I use Bonferroni, usually I would use REGWQ.

Page 20: Two-Way Balanced Independent Samples ANOVA Computations.

Bonferroni Tests, Main Effect of Smoking

• c = 10, so adj. criterion = .05 / 10 = .005.• n’s are 20: 20 scores went into each mean.

L e v e l i v s j t = S i g n i f i c a n t ? 1 v s 2

80.54496.3

20)20/120/1(119/)2545(

y e s

1 v s 3 ( 4 5 - 2 8 . 5 ) / 3 . 4 4 9 6 = 4 . 7 8 y e s 1 v s 4 ( 4 5 - 3 5 ) / 3 . 4 4 9 6 = 2 . 9 0 y e s 1 v s 5 ( 4 5 - 3 9 ) / 3 . 4 4 9 6 = 1 . 7 4 n o 2 v s 3 ( 2 8 . 5 - 2 5 ) / 3 . 4 4 9 6 = 1 . 0 1 n o 2 v s 4 ( 3 5 - 2 5 ) / 3 . 4 4 9 6 = 2 . 9 0 y e s 2 v s 5 ( 3 9 - 2 5 ) / 3 . 4 4 9 6 = 4 . 0 6 y e s 3 v s 4 ( 3 5 - 2 8 . 5 ) / 3 . 4 4 9 6 = 1 . 8 8 n o 3 v s 5 ( 3 9 - 2 8 . 5 ) / 3 . 4 4 9 6 = 3 . 0 4 y e s 4 v s 5 ( 3 9 - 3 5 ) / 3 . 4 4 9 6 = 1 . 1 6 n o

Page 21: Two-Way Balanced Independent Samples ANOVA Computations.

Smoking History Mean

< 1 m 25.0A

1m - 2y 28.5AB

2y - 7y 35.0BC

7y - 12y 39.0CD

Never 45.0D

Means sharing a superscript do not differ from one another at the .05 level.

Results of Bonferroni Test

Page 22: Two-Way Balanced Independent Samples ANOVA Computations.

Eta-Squared

• For the interaction,

• For gender,

• For smoking history, 197.115,26

140,52

346.115,26

025,92

047.115,26

12402

Page 23: Two-Way Balanced Independent Samples ANOVA Computations.

CI.90 Eta-Squared

• Compute the F that would be obtained were all other effects excluded from the model.

• For gender,

nInteractioSmokeError

Gender

MS

MSF

752.51)4490/()1240514010710(

1/9025

Page 24: Two-Way Balanced Independent Samples ANOVA Computations.

CI.90 Eta-Squared

Page 25: Two-Way Balanced Independent Samples ANOVA Computations.

Partial Eta-Squared

• Value of η2 can be affected by number and magnitude of other effects in model.

• For example, if our data were only from women, SSTotal would not include SSGender and SSInteraction.

• This would increase η2.• Partial eta-squared estimates effect if were

not other effects in the model.

Page 26: Two-Way Balanced Independent Samples ANOVA Computations.

Partial Eta-Squared

• For the interaction,

• For gender,

• For smoking history, 324.710,10140,5

140,52

p

457.710,10025,9

025,92

p

104.714,10240,1

240,12

p

Page 27: Two-Way Balanced Independent Samples ANOVA Computations.

CI.90 on Partial Eta-Squared

• If you use the source table F-ratios and df with the NoncF script, it will return confidence intervals on partial eta-squared.

Page 28: Two-Way Balanced Independent Samples ANOVA Computations.

CI.90 on Partial Eta-Squared

Page 29: Two-Way Balanced Independent Samples ANOVA Computations.

Omega-Squared

• For the interaction,

• For gender,

• For smoking history, 18.234,26

)119(4140,52

34.234,26

)119(1025,92

03.234,26

764

119115,26

)119(4240,12

Page 30: Two-Way Balanced Independent Samples ANOVA Computations.

Assumptions

• Normality within each cell• Homogeneity of variance across cells

Page 31: Two-Way Balanced Independent Samples ANOVA Computations.

Advantages of Factorial ANOVA

• Economy -- study the effects of two factors for (almost) the price of one.

• Power -- removing from the error term the effects of Factor B and the interaction gives a more powerful test of Factor A.

• Interaction -- see if effect of A varies across levels of B.

Page 32: Two-Way Balanced Independent Samples ANOVA Computations.

One-Way ANOVA

Consider the partitioning of the sums of squares illustrated to the right.SSB = 15 and SSE = 85. Suppose there are two levels of B (an experimental manipulation) and a total of 20 cases.

Page 33: Two-Way Balanced Independent Samples ANOVA Computations.

Treatment Not Significant

MSB = 15, MSE = 85/18 = 4.722. The F(1, 18) = 15/4.72 = 3.176, p = .092. Woe to us, the effect of our experimental treatment has fallen short of statistical significance.

Page 34: Two-Way Balanced Independent Samples ANOVA Computations.

Sex Not Included in the Model

• Now suppose that the subjects here consist of both men and women and that the sexes differ on the dependent variable.

• Since sex is not included in the model, variance due to sex is error variance, as is variance due to any interaction between sex and the experimental treatment.

Page 35: Two-Way Balanced Independent Samples ANOVA Computations.

Add Sex to the ModelLet us see what happens if we include sex and the interaction in the model. SSSex = 25, SSB = 15, SSSex*B = 10, and SSE = 50. Notice that the SSE has been reduced by removing from it the effects of sex and the interaction.

Page 36: Two-Way Balanced Independent Samples ANOVA Computations.

Enhancement of PowerThe MSB is still 15, but the MSE is now 50/16 = 3.125 and the F(1, 16) = 15/3.125 = 4.80, p = .044. Notice that excluding the variance due to sex and the interaction has reduced the error variance enough that now the main effect of the experimental treatment is significant.

Page 37: Two-Way Balanced Independent Samples ANOVA Computations.

Footnote

• Note that the confidence interval for the interaction includes zero. This is because:– If we did not remove the effect of gender and smoking

history from the error term then the effect of the interaction would no longer be statistically significant (p = .32).

– If we wanted the CI to be equivalent to the ANOVA F test, we would use partial 2 and we would a confidence coefficient of (1 – 2) = .90.

Page 38: Two-Way Balanced Independent Samples ANOVA Computations.

Presenting the Results

Participants were given a test of their ability to detect the scent of a chemical thought to have pheromonal properties in humans. Each participant had been classified into one of five groups based on his or her smoking history. A 2 x 5, Gender x Smoking History, ANOVA was employed, using a .05 criterion of statistical significance and a MSE of 119 for all effects tested. There were significant main effects of gender, F(1, 90) = 75.84, p < .001, ηp

2 = .46, 90% CI [.33, .55], and smoking history, F(4, 90) = 10.80, p < .001, , ηp

2 = .33, 90% CI [.17, .41],as well as a significant interaction between gender and smoking history, F(4, 90) = 2.61, p = .041, ηp

2 = .10, 90% CI [.002, .18]. As shown in Table 1, women were better able to detect this scent than were men, and smoking reduced ability to detect the scent, with recovery of function being greater the longer the period since the participant had last smoked.

Page 39: Two-Way Balanced Independent Samples ANOVA Computations.

Table 1. Mean ability to detect the scent. Smoking History Gender < 1 m 1 m -2 y 2 y - 7 y 7 y - 12 y never marginal Male 20 22 25 28 30 25 Female 30 35 45 50 60 44 Marginal 25 28 35 39 45

Page 40: Two-Way Balanced Independent Samples ANOVA Computations.

The significant interaction was further investigated with tests of the simple main effect of smoking history. For the men, the effect of smoking history fell short of statistical significance, F(4, 90) = 1.43, p = .23. For the women, smoking history had a significant effect on ability to detect the scent, F(4, 90) = 11.97, p < .001. This significant simple main effect was followed by a set of four contrasts. Each group of female ex-smokers was compared with the group of women who had never smoked. The Bonferroni inequality was employed to cap the familywise error rate at .05 for this family of four comparisons. It was found that the women who had never smoked had a significantly better ability to detect the scent than did women who had quit smoking one month to seven years earlier, but the difference between those who never smoked and those who had stopped smoking more than seven years ago was too small to be statistically significant.

Page 41: Two-Way Balanced Independent Samples ANOVA Computations.

Interaction Plot

< 1 m 1m - 2y 2y - 7y 7y - 12 y never10

20

30

40

50

60

70

Female

Male

Delay of Stimulation

Smoking History

Ability to Detect the Scent