/
Factorial ANOVA 2 or More IVs Factorial ANOVA 2 or More IVs

Factorial ANOVA 2 or More IVs - PowerPoint Presentation

tawny-fly
tawny-fly . @tawny-fly
Follow
343 views
Uploaded On 2019-06-23

Factorial ANOVA 2 or More IVs - PPT Presentation

Questions 1 What are main effects in ANOVA What are interactions in ANOVA How do you know you have an interaction What does it mean for a design to be completely crossed Balanced Orthogonal ID: 760063

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Factorial ANOVA 2 or More IVs" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Factorial ANOVA

2 or More IVs

Slide2

Questions (1)

What are main effects in ANOVA? What are interactions in ANOVA? How do you know you have an interaction? What does it mean for a design to be completely crossed? Balanced? Orthogonal? Describe each term in a linear model like this one:  

Slide3

Questions (2)

Correctly interpret ANOVA summary tables. Identify mistakes in such tables. What’s the matter with this one?

Source

SS

Df

MS

F

A

512

2 (J-1)

128

128

B

108

1 (K-1)

108

54

AxB

96

2 (J-1)(K-1)

48

24

Error

12

5 N-JK

2

Slide4

Questions (3)

Find correct critical values of

F

from a table

or software for

a given design.

How does post hoc testing for factorial ANOVA differ from post hoc testing in one-way ANOVA?

Describe a concrete example of a two-factor experiment. Why is it interesting and/or important to consider both factors in one experiment?

Slide5

2-way ANOVA

So far, 1-Way ANOVA, but can have 2 or more IVs. IVs aka Factors.Example: Study aids for examIV 1: workbook or notIV 2: 1 cup of coffee or not

Workbook (Factor A)

Caffeine (Factor B)

No

Yes

Yes

Caffeine only

Both

No

Neither (Control)

Workbook only

Slide6

Main Effects (R & C means)

N=30 per cellWorkbook (Factor A)Row MeansCaffeine(Factor B)NoYesYesCaff =80SD=5Both =85SD=582.5NoControl =75SD=5Book =80SD=577.5Col Means77.582.580

Slide7

Main Effects and Interactions

Main effects seen by row and column means; Slopes and breaks.Interactions seen by lack of parallel lines.Interactions are a main reason to use multiple IVs

Slide8

Single Main Effect for B

(Coffee only)

Slide9

Single Main Effect for A

(Workbook only)

Slide10

Two Main Effects; Both A & B

Both workbook and coffee

Slide11

Interaction (1)

Interactions take many forms; all show lack of parallel lines.

Coffee has no effect without the workbook.

Slide12

Interaction (2)

People with workbook do better without coffee; people without workbook do better with coffee.

Slide13

Interaction (3)

Coffee always helps, but it helps more if you use workbook.

Slide14

Labeling Factorial Designs

Levels – each IV is referred to by its number of levels, e.g., 2X2, 3X2, 4X3 designs. Two by two factorial ANOVA.

Cell – treatment combination.

Completely Crossed designs –each level of each factor appears at all levels of other factors (vs. nested designs or confounded designs).

Balanced – each cell has same n.

Orthogonal design – random sampling and assignment to balanced cells in completely crossed design.

Slide15

Review

What are main effects in ANOVA?

What are interactions in ANOVA? How do you know you have an interaction?

What does it mean for a design to be completely crossed? Balanced? Orthogonal?

Slide16

Population Effects for 2-way

Population main effect associated with the treatment Aj (first factor):

Population main effect associated with treatment B

k

(second factor):

The interaction is defined as , so the linear model is:

The interaction is a residual:

Each person’s score is a deviation from a cell mean (error). The cell means vary for 3 reasons.

Slide17

Expected Mean Squares

E(MS error) =

(Factor A has J levels; factor B has K levels; there are n people per cell.)

E

(MS A) =

E

(MS B) =

E

(MS Interaction) =

Note how all terms estimate error.

Slide18

F Tests

For orthogonal designs, F tests for the main effects and the interaction are simple. For each, find the F ratio by dividing the MS for the effect of interest by MS error.

Effect

FdfAJ-1,N-JKBK-1,N-JKAxBInteraction(J-1)(K-1), N-JK

Slide19

Example Factorial Design (1)

Effects of fatigue and alcohol consumption on driving performance.

Fatigue

Rested (8 hrs sleep then awake 4 hrs)

Fatigued (24 hrs no sleep)

Alcohol consumption

None (control)

2 beers

Blood alcohol .08 %

DV - performance errors on closed driving course rated by driving instructor.

Slide20

Cells of the Design

Alcohol (Factor A)Orthogonal design; n=2Fatigue (Factor B)None(J=1)2 beers(J=2).08 %(J=3)Tired(K=1)Cell 12, 4 M=3Cell 216, 18M=17Cell 318, 20M=19Rested(K=2)Cell 40, 2M=1Cell 52, 4M=3Cell 616, 18M=17

M=2

M=10

M=18

M=13

M=7

M=10

Slide21

Factorial Example Results

Main Effects?

Interactions?

Both main effects and the interaction appear significant. Let’s look.

Slide22

Data

Person

DV

Cell

A alc

B rest

1

2

1

1

1

2

4

1

1

1

3

16

2

2

1

4

18

2

2

1

5

18

3

3

1

6

20

3

3

1

7

0

4

1

2

8

2

4

1

2

9

2

5

2

2

10

4

5

2

2

11

16

6

3

2

12

18

6

3

2

Mean

10

Slide23

Total Sum of Squares

Person

DV

Mean

D

D*D

1

2

10

-8

64

2

4

10

-6

36

3

16

10

6

36

4

18

10

8

64

5

18

10

8

64

6

20

10

10

100

7

0

10

-10

100

8

2

10

-8

64

9

2

10

-8

64

10

4

10

-6

36

11

16

10

6

36

12

18

10

8

64

Total

728

Slide24

SS Within Cells

Person

DV

Cell

Mean

D*D

1

2

1

3

1

2

4

1

3

1

3

16

2

17

1

4

18

2

17

1

5

18

3

19

1

6

20

3

19

1

7

0

4

1

1

8

2

4

1

1

9

2

5

3

1

10

4

5

3

1

11

16

6

17

1

12

18

6

17

1

Total

12

Slide25

SS A – Effects of Alcohol

Person

M

Level (A)

Mean (A)

D*D

1

10

1

2

64

2

10

1

2

64

3

10

2

10

0

4

10

2

10

0

5

10

3

18

64

6

10

3

18

64

7

10

1

2

64

8

10

1

2

64

9

10

2

10

0

10

10

2

10

0

11

10

3

18

64

12

10

3

18

64

Total

512

Slide26

SS B – Effects of Fatigue

Person

M

Level (B)

Mean (B)

D*D

1

10

1

13

9

2

10

1

13

9

3

10

1

13

9

4

10

1

13

9

5

10

1

13

9

6

10

1

13

9

7

10

2

7

9

8

10

2

7

9

9

10

2

7

9

10

10

2

7

9

11

10

2

7

9

12

10

2

7

9

Total

108

Slide27

SS Cells – Total Between

Person

M

Cell

Mean (Cell)

D*D

1

10

1

3

49

2

10

1

3

49

3

10

2

17

49

4

10

2

17

49

5

10

3

19

81

6

10

3

19

81

7

10

4

1

81

8

10

4

1

81

9

10

5

3

49

10

10

5

3

49

11

10

6

17

49

12

10

6

17

49

Total

716

Slide28

Summary Table

Source SSTotal728Between716A512B108Within12

Check: Total=Within+Between728 = 716+12 

Interaction = Between – (A+B).Interaction = 716-(512+108) = 96.

SourceSSdfMSFA5122 (J-1)256128B1081(K-1)10854AxB962 (J-1)(K-1)4824Error126 (N-JK)2

Slide29

Interactions

Choose the factor with more levels for X, the horizontal axis. Plot the means. Join the means by lines representing the other factor. The size of the interaction SS is proportional to the lack of parallel lines.If interactions exist, the main effects must be qualified for the interactions. Here, effect of alcohol depends on the amount of rest of the participant.

Slide30

Software skills

Run the drink & drive problem in R

Data and code are in Canvas

Slide31

Review

Correctly interpret ANOVA summary tables. Identify mistakes in such tables. What’s the matter with this one?

Source

SS

Df

MS

F

A

512

2 (J-1)

128

128

B

108

1 (K-1)

108

54

AxB

96

2 (J-1)(K-1)

48

24

Error

12

5 N-JK

2

Slide32

Proportions of Variance

We can compute R-squared for magnitude of effect, but it’s biased, so the convention is to use omega-squared.

Slide33

Planned Comparisons

CellMeanC1C21 A1B13-1/31/22 A2B117-1/3-1/43 A3B119-1/3-1/44 A1B211/31/25 A2B231/3-1/46 A3B2171/3-1/4-6-12B1 v B2 No alc v others

Slide34

Planned Comparisons (2)

The first comparison (B1 v B2) has a value of –6. For any comparison,

Note this is the same as SS for B in the ANOVA.

Note 7.348 squared is 54, which is our value of F from the ANOVA.

(critical

t

has

df

e

)

Slide35

Planned Comparisons (3)

We can substitute planned comparisons for tests of main effects; they are equivalent (if you choose the relevant means). We can also do the same for interactions. In general, there are a total of (Cells-1) independent comparisons we can make (6-1 or 5 in our example). Our second test compared no alcohol to all other conditions.

This looks to be the largest comparison with these data.

Slide36

Post Hoc Tests

For post hoc tests about levels of a factor, we pool cells. The only real difference for Tukey HSD and Newman –Keuls is accounting for this difference. For interactions, we are back to comparing cells. Don’t test unless F for the effect is significant.

For comparing cells in the presence of an interaction:

Slide37

Post Hoc (2)

In our example A has 3 levels, B has 2. Both were significant. No post hoc for B (2 levels). For A, the column means were 2, 10, and 18. Are they different?

A: Yes, all are different because the differences are larger than 3.07. But because of the interaction, the interpretation of differences in A or B are tricky.

Slide38

Post Hoc (3)

For the rested folks, is the difference between no alcohol and 2 beers significant for driving errors? The means are 1 and 3.

A: They are not significantly different because 2 is less than 5.63. Note: data are fictitious. Do not drink and drive.

Slide39

Review

Describe each term in a linear model like this one:How does post hoc testing for factorial ANOVA differ from post hoc testing in one-way ANOVA? Describe a concrete example of a two-factor experiment. Why is it interesting and/or important to consider both factors in one experiment?

Slide40

Higher Order Factorials

If you can do ANOVA with 2 factors, you can do it with as many as you like.

For 3 factors, you have one 3-way interaction and three 2-way interactions.

Computations are simple but tedious.

For orthogonal, between-subject designs, all F tests have same denominator.

We generally don’t do designs with more than 3 factors. Complex & expensive.

Slide41

Review R code

Download and run R code for driving (post hoc tests), run

chocolate example

Slide42

Hays (5th ed) p. 520

A study involved children of three age groups:

A1=5yrs, A2= 6 years, A3 = 7 years.

Second Factor was formal preschool experience

B1=none, B2=1 year, B3 = more than 1 year

Five children were sampled from each combination and given a score on ‘social maturity’ (high scores are more mature)

Slide43

B1

B2

B3

A1

2

2

4

A1

6

7

8

A1

8

8

11

A1

10

8

5

A1

9

10

3

A2

7

6

9

A2

9

9

14

A2

11

9

15

A2

9

7

10

A2

8

8

12

A3

15

13

15

A3

12

12

18

A3

9

10

21

A3

10

6

10

A3

14

9

14

Slide44

Enter the data into R

Print the data to be sure they are correct

Be sure the data are arranged in the way

R

needs to analyze the problem

Slide45

Run a 2-Way ANOVA on the data

What terms are significant

What is the interpretation at the level of main effects and interactions from the printout?

Slide46

Graph the means

What is the interpretation of the means according to the graph?

Slide47

What is the magnitude of effect

What is R-square for A, B, and A*B?

What is estimated omega-squared for each?

Slide48

Unbalanced Designs

When you can assign to treatment, assign equal numbers in each cell

If unequal, unbalanced, and problems with tests

Participant mortality, design flaw, population characteristics (e.g., some types of cows more common in the herd)

Can delete or impute (but still problem)

Slide49

All SS Types same if balanced

Type I SS – simply sequential in terms of model entry

(two-factor

study: A, B,

AxB

)

Test A; test B|A ; test

AxB|A

, B

Type II SS- partly sequential, considers terms at the same ‘level’ e.g.,

A, B test of A considers B but not

AxB

(A|B; B|A;

AxB|A

, B)

Type III SS – last in – regression SS

(A|B,

AxB

; B|A,

AxB

;

AxB|A

, B)

Dispute about best approach. SAS uses Type III, R uses Type II. Arguments are difficult to understand (hypotheses tested and model selection).