1 Psych 5510/6510 Chapter 14 Repeated Measures ANOVA: Models with Nonindependent ERRORs Part 3:...

Post on 14-Dec-2015

225 views 2 download

Tags:

Transcript of 1 Psych 5510/6510 Chapter 14 Repeated Measures ANOVA: Models with Nonindependent ERRORs Part 3:...

1

Psych 5510/6510

Chapter 14

Repeated Measures ANOVA:

Models with Nonindependent ERRORs

Part 3: Factorial Designs

Spring, 2009

2

Non-Independence in Factorial Designs: Nested

Now we will look at applying these procedures to experiments with more than one independent variable.

In the first example one independent variable is whether the stimulus is the letter ‘A’ or ‘B’, the other independent variable is the color of the stimulus letter ‘White’ or ‘Black’. Subjects are nested within both independent variables.

3

DesignLetter

A B

White s1,s1 s2,s2

...

...

s5,s5 s6,s6

...

...

Color Black s7,s7 s8,s8

...

...

s11,s11 s12,s12

...

...

The effects of both independent variables and their interaction areall between-subjects as their effects will occur between subjects.

4

Transform to W0 scores

This situation is quite simple, we translate the repeated measures into just one score per person which represents conceptually (more or less) their mean score on the two measures.

220i11

(1)(Y2) Y1))(1(W

5

DesignLetter

A B

White W01 W02 ... ...

W05 W06 ... ...

Color Black W07 W08 ... ...

W011 W012

...

...

Now just proceed with the analysis, regressing W on the contraststhat code the independent variables and their interactions, just like youwould analyze Y scores.

6

Non-Independence in Factorial Designs: Crossed

In the next example subjects are crossed with both independent variables.

7

DesignLetter

A B

White s1 s2 s3 s4

s1 s2 s3 s4

Color Black s1 s2 s3 s4

s1 s2 s3 s4

The effects of both independent variables and their interaction areall within-subjects as their effects will occur within the multiplescores we have for each subject.

8

Data

Letter

A B

White 5 2 6 3

4 1 6 2

Color Black 6 3 6 5

3 1 4 3

9

Contrast Codes

Color White Black

Letter A B A B Contrast 1

(colors) -1 -1 1 1 Contrast 2

(letters) 1 -1 1 -1 Contrast 3

(interaction) -1 1 1 -1

We begin by setting up the contrast codes as we normally would for a 2-factor design, in the table below contrast 1 compares white letters with black letters, contrast 2 compares the letter A with the letter B, and contrast 3 does the interaction of letters and colors..

10

W Scores

All the independent variables are crossed with subjects, so the contrasts will be used to create W scores that will represent the effect of the independent variable on each subject’s scores.

11

W1i: Contrast One (i.e. Color)For example: computing W1 for subject 1 gives us:

Which contrasts his or her scores in the two white conditions (5 and 4) with his or her scores in the two black conditions (6 and 3).

We will do this for all the subjects, and then analyze their W1 scores to see if color made a difference.

02

0

1111

3)1(6)1(4)1(5)1(W

222211

12

W1i ScoresSubject W1i

(Contrast 1: color)

1 0

2 .5

3 -1

4 1.5

mean = 0.25

13

W1i Analysis of Contrast 1

Model C: Ŵ1i = B0 = 0

Model A: Ŵ1i = β0 = μW

If Model A is ‘worthwhile’ then using the mean of W1 works better as a model than using 0, which tells us that the mean of W1 is not 0. The mean of W1 would equal 0 if the null hypothesis were true and color did not have an effect on scores.

14

W1i Analysis of Contrast 1

SSR (reduction in error due to including Color in the model) can be computed using:

SSE(A) is simply the SS of the W1 scores:

SSE(A)=(SPSS ‘variance’ of variable W1)*(n-1) = 3.25

SSE(C)=SSE(A)+SSR=3.25+0.25=3.50

PRE = SSR/SSE(C) = 0.07

25.)25(.4)Wn( SSR 221

15

W1i Analysis of Contrast 1 (Color)

Source Source

Source SS df MS PRE F p

SSR Model Color .25 1 .25 .07 .23 .664

SSE(A) Error Color x S

3.25 3 1.08

SSE(C) Total Total

a) d.f. for a contrast always equals 1, b) d.f. for an interaction is the product of the d.f. of the terms that are interacting.

d.f. for the Color contrast = 1, d.f. for Subjects = n – 1, so d.f. error = (1)(n-1) = n – 1 = 3.

c) The p value can come from the PRE or F tools, or from doing a t test on W1 for a ‘One-Sample T test’ with a ‘test value’ of zero (on SPSS), which also gives you a t value (the square root of the F) and is a quick alternative if you don’t want the full source table.

16

W2i and W3i Analysis

Do the exact same type of analysis for W2 (the effect of I.V. “Letter”) and for W3 (the interaction of “Letter” and “Color”). In each case use the model comparison approach to determine if the mean of the W scores is significantly different than zero.

17

Within Subject Source TableThe table below combines the analyses of the three

contrasts (the real meat...carrot...of the analyses)

Source SS df MS F PRE p Within S’s 15.5 12

Color .25 1 .25 .23 .07 .67 Color x S 3.25 3 1.08

Letter 9 1 9 53.89 .95 .005 Letter x S .5 3 .17

Color x Letter 2.25 1 2.25 27.01 .90 .014 C x L x S .25 3 .08

Note the total SS and df Within S is the sum of its partitions.

18

Pooling Error TermsNotice that each contrast has its own unique error

term. In the ‘traditional ANOVA’ approach all of the error terms for the contrasts are ‘pooled’ together to make one error term. The disadvantage of pooling the error term is that its validity depends upon a rarely tested assumption that all of those error terms are estimating the same thing.

19

Full Source Table

Source SS df MS F PRE p Between S’s ? ? Within S’s 15.5 12

Color .25 1 .25 .23 .07 .67 Color x S 3.25 3 1.08

Letter 9 1 9 53.89 .95 .005 Letter x S .5 3 .17

Color x Letter 2.25 1 2.25 27.01 .90 .014 C x L x S .25 3 .08

Total ? ?

20

SS between subjects

A W0 score will be computed for each subject, giving us a single, composite, score for each subject. The SS of these W0 scores will give us SS between subjects.

W0 Subject 1 9.0 Subject 2 3.5 Subject 3 11.0 Subject 4 6.5

SSW0=31.5 dfW0=3

2222

43210

1111

)1()1()1()1(W

YYYY

21

SS Total

SS total is simply the SS of the 16 scores in the experiment: SS = 47

df total is n-1 =16-1=15

22

Full Source TableSource SS df MS F PRE p

Between S’s 31.5 3 Within S’s 15.5 12

Color .25 1 .25 .23 .07 .67 Color x S 3.25 3 1.08

Letter 9 1 9 53.89 .95 .005 Letter x S .5 3 .17

Color x Letter 2.25 1 2.25 27.01 .90 .014 C x L x S .25 3 .08

Total 47 15

23

Nonindependence in Mixed Designs

Now we will turn our attention to the most complicated situation, a factorial design where some independent variables are between-subjects (i.e. subjects are nested) and some independent variables are within subjects (i.e. subjects are crossed).

24

Design Activity Passive Active

First

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16

List

Second

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16

25

Data

Activity Passive Active

First

7 5 6 7 8 7 5 6

6 5 4 3 4 5 3 3

List

Second

8 6 9 6 8 7 6 8

6 6 4 5 5 5 3 5

26

Between-Subjects

Look back at the ‘design’ slide. The IV “Activity” (Passive vs. Active) is a between-subjects treatment. We could simply set up a contrast variable, X = -1 or 1, and regress Y on it, but we have two Y scores per subject and those scores will be nonindependent.

Solution: use W0 to get just one score per subject

22011

(1)(Y2)(1)(Y1)W

27

Subject Y list 1 Y list 2 W0 Activity X

1 7 8 10.61 Passive -1

2 5 6 7.78 Passive -1

3 6 9 10.61 Passive -1

4 7 6 9.19 Passive -1

5 8 8 11.31 Passive -1

6 7 7 9.89 Passive -1

7 5 6 7.78 Passive -1

8 6 8 9.89 Passive -1

9 6 6 8.49 Active 1

10 5 6 7.78 Active 1

11 4 4 5.66 Active 1

12 3 5 5.66 Active 1

13 4 5 6.36 Active 1

14 5 5 7.07 Active 1

15 3 3 4.24 Active 1

16 3 5 5.66 Active 1

W0 gives us 1score per S, regress W0 onX to see if type of activity had an effect.

28

Analysis of IV Activity

ANOVAb

42.781 1 42.781 24.018 .000a

24.937 14 1.781

67.719 15

Regression

Residual

Total

Model1

Sum ofSquares df Mean Square F Sig.

Predictors: (Constant), Xa.

Dependent Variable: W0b.

Model Summary

.795a .632 .605 1.33463Model1

R R SquareAdjustedR Square

Std. Error ofthe Estimate

Predictors: (Constant), Xa.

29

Within-subject Analysis

The analysis of the IV “List” (“First” vs “Second”), and the analysis of the interaction between “List” and “Activity” both involve within-subject differences (the interaction involves both within-subject and between-subject differences).

To analyze these we will need to use W1 scores.

30

W1i scores

To determine the difference between a subject’s score in the first list with the same subject’s score in the second list we will use a contrast of +1 for the first list, -1 for the second list, and use these deltas for computing each subject’s W1 score.

2211)(1

(-1)(Y2)(1)(Y1)W

31

Subject Y list 1 Y list 2 W0 Activity X W1

1 7 8 10.61 Passive -1 .71

2 5 6 7.78 Passive -1 .71

3 6 9 10.61 Passive -1 2.12

4 7 6 9.19 Passive -1 -.71

5 8 8 11.31 Passive -1 0

6 7 7 9.89 Passive -1 0

7 5 6 7.78 Passive -1 .71

8 6 8 9.89 Passive -1 1.41

9 6 6 8.49 Active 1 0

10 5 6 7.78 Active 1 .71

11 4 4 5.66 Active 1 0

12 3 5 5.66 Active 1 1.41

13 4 5 6.36 Active 1 .71

14 5 5 7.07 Active 1 0

15 3 3 4.24 Active 1 0

16 3 5 5.66 Active 1 1.41

32

Looking for an effect due to “List”

Subject W1

1 .71

2 .71

3 2.12

4 -.71

5 0

6 0

7 .71

8 1.41

9 0

10 .71

11 0

12 1.41

13 .71

14 0

15 0

16 1.41

Mean .57

Note each W1 score reflects thedifference between when thesubject was measured in the firstlist versus when he or she wasmeasured in the second list.

Conceptually, the question here iswhether the μ of W1i = 0.

2211)(1

(-1)(Y2)(1)(Y1)W

33

Looking for an interaction between “List” and “Activity”

Passive Active

Subject W1 Subject W1

1 .71 9 0

2 .71 10 .71

3 2.12 11 0

4 -.71 12 1.41

5 0 13 .71

6 0 14 0

7 .71 15 0

8 1.41 16 1.41

Mean .62 Mean .53

Here are the same W1 scores listed according to ‘Activity’. Remember, W1 measures the effect of ‘List’, if the effect of List depends upon Activity then the two interact, this will be seen in a difference in the means of the W1 scores in the two groups.

34

Within-subject Analysis

Review the last two slides:

1. The test to determine whether ‘List’ has an effect examines whether the mean of all of the W1 scores differs from zero.

2. The test to determine whether ‘List’ and ‘Activity’ interact examines whether the mean of W1 scores in the ‘Passive’ group differs from the mean of the W1 scores in the ‘Active’ group.

3. Fortunately, we can easily answer both questions at once...

35

Subject Y list 1 Y list 2 W0 Activity X W1

1 7 8 10.61 Passive -1 .71

2 5 6 7.78 Passive -1 .71

3 6 9 10.61 Passive -1 2.12

4 7 6 9.19 Passive -1 -.71

5 8 8 11.31 Passive -1 0

6 7 7 9.89 Passive -1 0

7 5 6 7.78 Passive -1 .71

8 6 8 9.89 Passive -1 1.41

9 6 6 8.49 Active 1 0

10 5 6 7.78 Active 1 .71

11 4 4 5.66 Active 1 0

12 3 5 5.66 Active 1 1.41

13 4 5 6.36 Active 1 .71

14 5 5 7.07 Active 1 0

15 3 3 4.24 Active 1 0

16 3 5 5.66 Active 1 1.41

All we needto do is toregress W1(which measures theeffect of ‘List’)on X (whichcodes ‘Activity’)

36

Regressing W1 on XModel Summary

.062a .004 -.067 .76474Model1

R R SquareAdjustedR Square

Std. Error ofthe Estimate

Predictors: (Constant), Xa.

ANOVAb

.031 1 .031 .053 .821a

8.188 14 .585

8.219 15

Regression

Residual

Total

Model1

Sum ofSquares df Mean Square F Sig.

Predictors: (Constant), Xa.

Dependent Variable: W1b.

Coefficientsa

-.575 .191 -3.005 .009

.044 .191 .062 .231 .821

(Constant)

X

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: W1a.

37

Testing for an Effect Due to List

If ‘List’ has no effect then the mean of W1 should be zero. When we regress W1 on X we get: Ŵ1i = β0 + β1Xi, now it is interesting to note that X (because it is a contrast) has a mean of zero, and because of this β0 = μW1. So we can do the following to see if μW1=0.

Model C: Ŵ1i = B0 + β1Xi where B0 = 0

Model A: Ŵ1i = β0 + β1Xi where β0 = μW1

H0: β0 = B0 or alternatively μW1 = 0

HA: β0 B0 or alternatively μW1 0

38

Model C: Ŵ1i = B0 + β1Xi where B0 = 0

Model A: Ŵ1i = β0 + β1Xi where β0 = μW1

H0: β0 = B0 or alternatively μW1 = 0

HA: β0 B0 or alternatively μW1 0

To ask whether μW1 = 0 is to ask whether β0 = 0, and the SPSS printout provides a t test to see whether or not β0 = 0. t=-3.005, p=.009. So we can conclude that List does indeed have an effect.

Coefficientsa

-.575 .191 -3.005 .009

.044 .191 .062 .231 .821

(Constant)

X

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: W1a.

Ŵ1i = -.575 + .044Xi

39

Filling in the Summary TableŴ1i = -.575 + .044Xi (see previous slide)

Model C: Ŵ1i = B0 + β1Xi = 0 + .044Xi PC=1

Model A: Ŵ1i = β0 + β1Xi = -.575 + .044Xi PA=2

SSE(A) = SS residual from regressing W1 on X = 8.188 and df=14 (see earlier slide)

PRE=SSR/SSE(C)=0.39

MS = SSR/df = 5.29/1 = 5.29

F=t²=-.3005²=9.03 (see previous slide)

p=.009 (see previous slide)

15PCNdf 478.1329.58.188SSRSSE(A)SSE(C)

1 PC-PA df 5.29)575.(16)Wn( SSR 221

40

Summary Table for I.V. ‘List’

Source SS df MS F PRE p

SSR

(List)

5.29 1 5.29 9.03 0.39 .009

SSE(A)

(Error)

8.188 14 0.585

SSE(C)

(Total)

13.478 15

41

Effect Due to List x Activity Interaction

To say that “List” and “Activity” do not interact is to say that knowing X does not help predict the value of W1 (go back to the slide that covers that). So we have:

Model C: Ŵ1i = β0

Model A: Ŵ1i = β0 + β1Xi

Which, of course, is simply the analysis of regressing W1 on X.

42

Summary Table for List x Activity Interaction

Source SS df MS F PRE p

SSR

(List x Activity)

.031 1 .031 .053 0.004 .821

SSE(A)

(Error)

8.188 14 0.585

SSE(C)

(Total)

8.219 15

Taken right off of the SPSS output for regressing W1 on X

43

Error TermNote we have the same error term for both the

effect due to list and the effect of list by activity interaction.

The error term is for the same Model A in both cases and actually represents the List x Activity X Subject interaction..

44

Within-Subject Source Table

Source SS df MS F* PRE p

List 5.29 1 5.29 9.03 .39 .009

List x Activity .031 1 .03 .053 .005 .821

Error (List x Activity x S)

8.188 14 .585

Total Within 13.51 16

45

Final Source Table

Source SS df MS F* PRE p

Between Subjects 67.72 15

Activity 42.78 1 42.78 24.02 .63 .000

Error between Ss 24.94 14 1.78

Within Subjects 13.51 16

List 5.29 1 5.29 9.03 .39 .009

List x Activity .031 1 .031 .053 .005 .821

Error (List x Activity x S)

8.188 14 .585

Total 81.22 31

46

Simple Summary1) Between subjects contrast: compute the W0 scores, regressW0 on the between subjects contrast (X1 in this example)

ANOVAb

42.781 1 42.781 24.018 .000a

24.937 14 1.781

67.719 15

Regression

Residual

Total

Model1

Sum ofSquares df Mean Square F Sig.

Predictors: (Constant), Xa.

Dependent Variable: W0b.

1100 XββW

47

Simple Summary

Coefficientsa

-.575 .191 -3.005 .009

.044 .191 .062 .231 .821

(Constant)

X

Model1

B Std. Error

UnstandardizedCoefficients

Beta

StandardizedCoefficients

t Sig.

Dependent Variable: W1a.

2) Within subjects contrast, and 3) interactionW1 represents the within subjects contrast. X1 represents thebetween subjects contrast. If we regress W1 on X1 we get:

Ŵ1i = -.575 + .044Xi

Testing to see if b0 differs from zero tells us if the within subjects

contrast is significant, testing to see if b1 differs from zero tellsus if there is an interaction between the within and between subjects variables. SPSS does both of those...