/
Repeated Measure Design of ANOVA Repeated Measure Design of ANOVA

Repeated Measure Design of ANOVA - PowerPoint Presentation

pasty-toler
pasty-toler . @pasty-toler
Follow
607 views
Uploaded On 2015-09-29

Repeated Measure Design of ANOVA - PPT Presentation

AMS 572 Group 5 Outline Jia Chen Introduction of repeated measures ANOVA Chewei Lu Oneway repeated measures Wei Xi Twofactor repeated measures Tomoaki Sakamoto Threefactor repeated measures ID: 144224

repeated anova subjects measures anova repeated measures subjects data factor shape model error effect subject hypothesis output sas mixed

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Repeated Measure Design of ANOVA" 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

Repeated Measure Design of ANOVA

AMS 572 Group 5Slide2

Outline

Jia

Chen: Introduction of repeated measures ANOVA

Chewei

Lu: One-way repeated measures

Wei Xi: Two-factor repeated measures

Tomoaki

Sakamoto : Three-factor repeated measures

How-Chung Liu: Mixed models

Margaret Brown: Comparison

Xiao Liu: ConclusionSlide3

Introduction of Repeated Measures ANOVA

Jia

ChenSlide4

What is it ?

Definition:

- It is a technique used to test the equality of means.

Slide5

When To Use It?

It is used when all members of a random sample are measured under a number of different conditions.

As the sample is exposed to each condition in turn, the measurement of dependent variable is repeated.Slide6

Introduction of One-Way Repeated Measures ANOVA

Che

-Wei, Lu

Professor:Wei

ZhuSlide7

One-Way Repeated Measures ANOVA

Definition

A one-way repeated measures ANOVA instead of having one score per subject, experiments are frequently conducted in which multiple score are gathered for each case.

Concept of Repeated Measures

ANOVA

One factor with at least two levels, levels are dependent.

Dependent means that they share variability in some way.

The Repeated Measures ANOVA is extended from standard ANOVA.Slide8

One-Way Repeated Measures ANOVA

When to Use

Measuring performance on the same variable over time

for example looking at changes in performance during training or before and after a specific treatment

The same subject is measured multiple times under different conditions

for example performance when taking Drug A and performance when taking Drug B

The same subjects provide measures/ratings on different characteristics

for example the desirability of red cars, green cars and blue cars

Note how we could do some RM as regular between subjects designs

For example, Randomly assign to drug A or BSlide9

One-Way Repeated Measures ANOVA

Source of Variance in Repeated Measures ANOVA

SStotal

Deviation of each individual score from the grand mean

SSb

/t subjects

Deviation of subjects' individual means (across treatments) from the grand mean.

In the RM setting, this is largely uninteresting, as we can pretty much assume that

subjects differ

SSw

/in subjects: How

Ss

vary about their own mean, breaks down into:

SStreatment

As in between subjects ANOVA, is the comparison of treatment means to each other (by examining their deviations from the grand mean)

However this is now a partition of the within subjects variation

SSerror

Variability of individuals

scores about their treatment meanSlide10

One-Way Repeated Measures ANOVA

Partition of Sum of Square

 

 

 

 

 

Repeated Measures ANOVA

 

 

 

Standard ANOVASlide11

One-Way Repeated Measures ANOVA

Variation

SS

Df

MS

F

Between

a-1

MSA=

F=

Within

N-a

MSE=

Total

N-1

Variation

SS

Df

MS

F

Between

a-1

Within

N-a

Total

N-1

Standard ANOVA Table

Repeated Measures ANOVA Table

SS

Df

MS

F

Between

a-1

MSA=

F=

Within

N-a

-Subjects

s-1

-Error

MSE=

Total

N-A

SS

Df

MS

F

Between

a-1

Within

N-a

-Subjects

s-1

-Error

Total

N-ASlide12

One-Way Repeated Measures ANOVA

Example:

Researchers want to test a new anti-anxiety medication. They measure the anxiety of 7 participants three times: once before taking the medication, once one week after taking the medication, and once two weeks after taking medication. Anxiety is rated on a scale of 1-10,with 10 being ”high anxiety” and 1 being “low anxiety”. Are there any difference between the three condition using significant level

 

Participants

Before

Week1

Week2

1

9

7

4

2

8

6

3

3

7

6

2

4

8

7

3

5

8

8

4

6

9

7

3786

2Slide13

One-Way Repeated Measures ANOVA

Define Null and Alternative Hypotheses

 

Participants

Before

Week1

Week2

1

9

7

4

2

8

6

3

3

7

6

2

4

8

7

3

5

8

8

4

6

9

7

3

7

8

6

2Slide14

One-Way Repeated Measures ANOVA

Define Degrees of Freedom

N=21 s=7

-

=18-6=12

 

Participants

Before

Week1

Week2

1

9

7

4

2

8

6

3

3

7

6

2

4

8

7

3

5

8

8

4

6

9

7

3

7

8

6

2Slide15

One-Way Repeated Measures ANOVA

Analysis of Variance

 

Participants

Before

Week1

Week2

1

9

7

4

2

8

6

3

3

7

6

2

4

8

7

3

5

8

8

4

6

9

7

3

7

8

6

2Slide16

One-Way Repeated Measures ANOVA

Analysis of

Variance(ANOVA Table)

SS

Df

MS

F

Between

98.67

2

49.34

224.27

Within

10.29

18

-Subjects

7.62

6

-Error

2.67

12

0.22

Total

108.96

20

Error=within-Subjects=10.29-7.62=2.67

Total=

Beteen+Within

=98.67+10.29=108.96

Test Statistic

:

244.27

 Slide17

One-Way Repeated Measures ANOVA

Critical Region

Now, the

 

SS

Df

MS

F

Between

98.67

2

49.34

224.27

Within

10.29

18

-Subjects

7.62

6

-Error

2.67

12

0.22

Total

108.96

20Slide18

One-Way Repeated Measures ANOVA

SAS Code

DATA

REPEAT;

INPUT SUBJ BEFORE WEEK1 WEEK2;

DATALINES;

1 9 7 4

2 8 6 3

3 7 6 2

4 8 7 3

5 8 8 4

6 9 7 3

7 8 6 2

;

PROC

ANOVA

DATA=REPEAT;

TITLE "One-Way ANOVA using the repeated

Statment

";

MODEL BEFORE WEEK1 WEEK2= / NOUNI;

REPEATED TIME

3

(

1

2 3);RUN;

The Before, Week1, and Week2 are the time level at each participants.

In here, we don’t have CLASS statement because our data set does not have an independent variable

The NOUNI(no

univariate

) is a request not to conduct a separate analysis for each of the three times variables.

This indicates the labels we want to printed for each level of timesSlide19

One-Way Repeated Measures ANOVA

SAS ResultSlide20

Two-Factor ANOVA with Repeated Measures

Wei XiSlide21

Stating of the HypothesisSlide22

Two-Factor ANOVA with Repeated Measures on One FactorSlide23

HypothesisSlide24

ANOVA TABLE

Source

DF

SS

MS

F

Factor A

a-1

SSA

SSA/(a-1)

MSA/MSWA

F

(a-1),n(a-1)

Factor

B

b-1

SSB

SSB/(b-1)

MSB/MSE

F

(b-1),n(a-1)(b-1)

AB Interaction

(a-1)(b-1)

SSAB

SSAB/(a-1)(b-1)MSAB/MSE ~ F

(a-1)(b-1,n(a-1)(b-1)Subjects within A

(n-1)aSSWASSWA/(n-1)a

Error (n-1)a(b-1)SSE

SSE/((n-1)a(b-1)Total nab-1SSTSlide25

Example

The

shape

variable is the repeated variable. This produces an ANOVA with one between-subjects factor. If you were to examine the expected mean squares for this setup, you would find that the appropriate error term for the test of

calib

is

subject|calib

. The appropriate error term for

shape

and

shape#calib

is

shape#subject|calib

(which is the residual error since we do not include the term in the model).Slide26

SAS Code

Data

Q1;

set

pre.Q1;

run

;

proc

anova

data=Q1;

title

' Two-way Anova with a Repeated Measure on One Factor';

class

calib;

model

shape_1 shape_2 shape_3 shape_4 = calib/

nouni

;

repeated shape

4

;

means calib;

run; Slide27

MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no shape Effect

H = Anova SSCP Matrix for shape

E = Error SSCP Matrix

S=1    M=0.5    N=0

Statistic

Value

F Value

Num DF

Den DF

Pr > F

Wilks' Lambda

0.02529573

25.69

3

2

0.0377

Pillai's Trace

0.97470427

25.69

3

2

0.0377

Hotelling-Lawley Trace

38.53236607

25.69

3

2

0.0377

Roy's Greatest Root

38.53236607

25.69

3

2

0.0377

MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no shape*calib Effect

H = Anova SSCP Matrix for shape*calib

E = Error SSCP Matrix

S=1    M=0.5    N=0

Statistic

Value

F Value

Num DF

Den DF

Pr > F

Wilks' Lambda

0.16750795

3.31

3

2

0.2404

Pillai's Trace

0.83249205

3.31

3

2

0.2404

Hotelling-Lawley Trace

4.96986607

3.31

3

2

0.2404

Roy's Greatest Root

4.96986607

3.31

3

2

0.2404

At

α

=0.05

,we

reject

the hypothesis and conclude that there is shape Effect

At

α

=0.05

,we

cannot

reject

the hypothesis and conclude that there is

no

shape*calib Effect

Analysis of SAS OutputSlide28

Source

DF

Anova SS

Mean Square

F Value

Pr > F

calib

1

51.04166667

51.04166667

11.89

0.0261

Error

4

17.16666667

4.29166667

Source

DF

Anova SS

Mean Square

F Value

Pr > F

Adj Pr > F

G - G

H - F

shape

3

47.45833333

15.81944444

12.80

0.0005

0.0099

0.0011

shape*calib

3

7.45833333

2.48611111

2.01

0.1662

0.2152

0.1791

Error(shape)

12

14.83333333

1.23611111

Univariate Tests of Hypotheses for Within Subject Effects

Tests of Hypotheses for Between Subjects EffectsSlide29

Two-Factor ANOVA with Repeated Measures on both

FactorsSlide30

Source

DF

SS

MS

F

Subjects

n-1

SSS

SSS/I-1

MSS/MSE

Factor A

a-1

SSA

SSA/(a-1)

MSA/MSA*S

F(a-1),(n-1)(a-1)

Factor B

b-1

SSB

SSB/(b-1)

MSB/MSB*S

F(b-1),(n-1)(b-1)

AB Interaction

(a-1)(b-1)

SSAB

SSAB/((a-1)(b-1))

MSAB/MSE

F(a-1)(b-1),(n-1)(a-1)(b-1)

A*Subjects

(n-1)(a-1)

SSA*S

SSWA/((n-1)a)

SSA*S/MSE

F(a-1)(n-1),(n-1)(a-1)(b-1)

B*Subjects

(n-1)(b-1)

SSB*S

SSWB/((n-1)b)

SSA*S/MSE

F(n-1)(b-1),(n-1)(a-1)(b-1)

Error

(n-a)(a-1)(b-1)

SSE

SSE/((n-1)(a-1)(b-1))

Total

nab-1

SST

ANOVA TABLESlide31

Example

Three subjects, each with nine accuracy scores on all combinations of the three different dials and three different periods. With

subject

a random factor and both

dial

and

period

fixed factors, the appropriate error term for the test of

dial

is the

dial#subject

interaction. Likewise,

period#subject

is the correct error term for

period

, and

period#dial#subject

(which we will drop so that it becomes residual error) is the appropriate error term for

period#dial

.

Slide32

SAS Code

Data

Q2;

Input

Mins1-Mins9;

Datalines

;

45 53 60 40 52 57 28 37 46

35 41 50 30 37 47 28 32 41

60 65 75 58 54 70 40 47 50

;

ODS RTF STYLE=

BarrettsBlue

;

Proc

anova

data=Q2;

Model Mins1-Mins9=/

nouni

;

Repeated period 3,

dail

3/nom;

Run;

ods

rtf close;

Slide33

SAS Output

Source

DF

Anova SS

Mean Square

F Value

Pr > F

Adj Pr > F

G - G

H - F

period

2

1072.666667

536.333333

14.45

0.0148

0.0563

0.0394

Error(period)

4

148.444444

37.111111

Greenhouse-

Geisser

Epsilon

0.5364

Huynh-

Feldt

Epsilon

0.6569

Source

DF

Anova SS

Mean Square

F Value

Pr > F

Adj Pr > F

G - G

H - F

dail

2

978.6666667

489.3333333

50.91

0.0014

0.0169

0.0115

Error(

dail

)

4

38.4444444

9.6111111

Greenhouse-

Geisser

Epsilon

0.5227

Huynh-

Feldt

Epsilon

0.5952

Source

DF

Anova SS

Mean Square

F Value

Pr > F

Adj Pr > F

G - G

H - F

period*dail

4

8.66666667

2.16666667

0.30

0.8715

0.6603

0.7194

Error(period*

dail

)

8

58.22222222

7.27777778

Greenhouse-

Geisser

Epsilon

0.2827

Huynh-

Feldt

Epsilon

0.4006

Univariate Tests of Hypotheses for Within Subject Effects

At

α

=0.05

,we

cannot

reject the hypothesis and conclude the there is

no

period*

dail

Effect

At

α

=0.05

,we

reject

the hypothesis and conclude that there is

dail

Effect

At

α

=0.05

,we

reject

the hypothesis and conclude that there is period EffectSlide34

Three-factor Experiments

with a repeated measure

T. SakamotoSlide35

35

/8

7

Example of a

marketing experiment

Experiment

The

subjects

who belong to a region X or Y see the Liquid Crystal Display A, B, or C.

Each type of LCD is seen twice; once in the light and the other in the dark.

The preferences of the LCD are measured by the subjects, on a scale from 1 to 5 (1= lowest, 5=highest).

Case of this example

A company which produces some Liquid Crystal Display wants to examine the characteristics of its prototype products.Slide36

36

/8

7

Experimental Design and Data

Three factors

Type of LCD

Regions to which the specimens belong

In the light / In the dark

Repeted measure factor : In the light / In the dark

Type of LCD

A

B

C

subj

light

dark

subj

light

dark

subj

light

dark

REGION

X

1

5

4

11

4

4

21

5

5

2

4

2

12

5

6

22

5

3

3

5

4

13

3

4

23

3

3

4

3

5

14

5

4

24

4

4

5

5

3

15

4

6

25

4

3

Y

6

4

4

16

5

5

26

3

5

7

3

5

17

4

3

27

4

3

8

4

3

18

5

3

28

5

2

9

2

5

19

5

5

29

3

4

10

5

4

20

4

4

30

4

3Slide37

37

/8

7

data

lcd;

input

subj type $ region $ light dark @@;

datalines

;

1 a 5 4 2 a 4 2 3 a 5 4 4 a 3 5 5 a 5 3

6 a 4 4 7 a 3 5 8 a 4 3 9 a 2 5 10 a 5 4

11 b 4 4 12 b 5 6 13 b 3 4 14 b 5 4 15 b 4 6

16 b 5 5 17 b 4 3 18 b 5 3 19 b 5 5 20 b 4 4

21 c 5 5 22 c 5 3 23 c 3 3 24 c 4 4 25 c 4 3

26 c 3 5 27 c 4 3 28 c 5 2 29 c 3 4 30 c 4 3

;

run

;

proc anova

data

=lcd;

title

’Three-way ANOVA with a Repeated Measure'

;

class

type region;

model

light dark = type | region /

nouni

;

repeated light_dark;means type | region;

run;

SAS PROGRAMSlide38

OUTPUT(Part 1/4):Slide39

OUTPUT(Part 2/4):Slide40

40

/81

OUTPUT(Part 3/4):Slide41

OUTPUT(Part 4/4):Slide42

Mixed Effect Models

How-Chang LiuSlide43

Mixed Models

When we have a model that contains random effect as well as fixed effect, then we are dealing with a mixed model.

From the above definition, we see that mixed models must contain at least two factors.

One having fixed effect and one having random effect.Slide44

Why use mixed models?

When repeated measurements are made on the same statistical units, it would not be realistic to assume that these measurements are independent.

We can take this dependence into account by specifying covariance structures using a mixed modelSlide45

Definition

A mixed model can be represented in matrix notation by:

is the vector of observations

is the vector of fixed effects

is the vector of random effects

is the vector of I.I.D. error terms

and

are matrices relating

and

to

 Slide46

Assumptions

R and G are constants

We also assume that

and

are independent

We get V

= ZGZ' +

R, where V is the variance of y

 Slide47

How to estimate

and

?

 

If R and G are given: Using Henderson’s Mixed Model equation, we have:

=

So

=

And

=

)

 Slide48

What if G and R are unknown?

We know that both

and

are normally distributed, so the best approach is to use likelihood based methods

There are two methods used by SAS:

1)Maximum likelihood (ML)

2)Restricted/residual maximum likelihood (REML)

 Slide49

Example

Below is a table of growth measurements for 11 girls and 16 boys at ages 8, 10, 12, 14:

Person gender age8 age10 age12 age14

1 F 21.0 20.0 21.5 23.0

2 F 21.0 21.5 24.0 25.5

3 F 20.5 24.0 24.5 26.0

4 F 23.5 24.5 25.0 26.5

5 F 21.5 23.0 22.5 23.5

6 F 20.0 21.0 21.0 22.5

7 F 21.5 22.5 23.0 25.0

8 F 23.0 23.0 23.5 24.0

9 F 20.0 21.0 22.0 21.5

10 F 16.5 19.0 19.0 19.5

11 F 24.5 25.0 28.0 28.0

12

M

26.0 25.0 29.0 31.0

13 M 21.5 22.5 23.0 26.5

14 M 23.0 22.5 24.0 27.5

Person

gender age8 age10 age12

age14

15 M 25.5 27.5 26.5 27.0

16

M 20.0 23.5 22.5 26.0 17 M 24.5 25.5 27.0 28.5 18 M 22.0 22.0 24.5 26.5 19

M 24.0 21.5 24.5 25.5 20 M 23.0 20.5 31.0 26.0 21 M 27.5 28.0 31.0 31.5

22 M 23.0 23.0 23.5 25.0 23 M 21.5 23.5 24.0 28.0 24 M 17.0 24.5 26.0 29.5 25 M 22.5 25.5 25.5 26.0 26 M 23.0 24.5 26.0

30.0 27 M 22.0 21.5 23.5 25.0 Slide50

Using SAS

data

pr

;

input

Person

Gender

$ y1 y2 y3 y4;

y=y1

;

Age

=8; output;

y=y2

;

Age

=10; output;

y=y3

;

Age

=12; output;

y=y4

;

Age=14; output; drop y1-y4;

datalines; 1 F 21.0 20.0 21.5 23.0 2 F 21.0 21.5 24.0 25.5

…;Run;Slide51

Using SAS

proc

mixed data=

pr

method=ml

covtest

;

class

Person Gender;

model

y = Gender Age Gender*Age / s;

repeated

/ type=un

subject=Person r;

run

; Slide52

Results

Model Information

Data Set

WORK.PR

Dependent Variable

y

Covariance Structure

Unstructured

Subject Effect

Person

Estimation Method

ML

Residual Variance Method

None

Fixed Effects SE Method

Model-Based

Degrees of Freedom Method

Between-Within

Class Level Information

Class

Levels

Values

Person

27

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

Gender

2

F M

As one can see, the covariance matrix is unstructured, as we are going to estimate it using the maximum likelihood methodSlide53

Dimensions

Covariance Parameters

10

Columns in X

6

Columns in Z

0

Subjects

27

Max Obs Per Subject

4

Number of Observations

Number of Observations Read

108

Number of Observations Used

108

Number of Observations Not Used

0

Iteration History

Iteration

Evaluations

-2 Log Like

Criterion

0

1

478.24175986

 

1

2

419.47721707

0.00000152

2

1

419.47704812

0.00000000

Convergence criteria met.

As one can see, we do not have a Z matrix for this model

the

convergence of the Newton-

Raphson

algorithm

means that we have found the maximum likelihood estimatesSlide54

Covariance Parameter Estimates

Cov Parm

Subject

Estimate

Standard Error

Z Value

Pr Z

UN(1,1)

Person

5.1192

1.4169

3.61

0.0002

UN(2,1)

Person

2.4409

0.9835

2.48

0.0131

UN(2,2)

Person

3.9279

1.0824

3.63

0.0001

UN(3,1)

Person

3.6105

1.2767

2.83

0.0047

UN(3,2)

Person

2.7175

1.0740

2.53

0.0114

UN(3,3)

Person

5.9798

1.6279

3.67

0.0001

UN(4,1)

Person

2.5222

1.0649

2.37

0.0179

UN(4,2)

Person

3.06241.01353.020.0025

UN(4,3)Person3.82351.25083.060.0022UN(4,4)Person4.61801.2573

3.670.0001The table lists the 10 estimated covariance parameters in order. In other words, these are the estimates for R, the variance of  Slide55

Solution for Fixed Effects

Effect

Gender

Estimate

Standard Error

DF

t Value

Pr > |t|

Intercept

 

15.8423

0.9356

25

16.93

<.0001

Gender

F

1.5831

1.4658

25

1.08

0.2904

Gender

M

0

.

.

.

.

Age

 

0.8268

0.07911

25

10.45

<.0001

Age*Gender

F

-0.3504

0.1239

25

-2.83

0.0091

Age*Gender

M

0

.

.

.

.

From this table, we see that the boys intercept is at 15.8423, whole the girls intercept is at 15.8423+1.5831=17.42.

The estimate of the boys’ slope is at 0.827, while the girls’ slpe

is at 0.827-0.350=0.477So the girls’ starting point is higher than the girls but their growth rate is only about half of that of the boysSlide56

Type 3 Tests of Fixed Effects

Effect

Num DF

Den DF

F Value

Pr > F

Gender

1

25

1.17

0.2904

Age

1

25

110.54

<.0001

Age*Gender

1

25

7.99

0.0091

This is probably the most important table from our results:

The gender row tests the null hypothesis that girls and boys have a common intercept.

As we can see we cannot reject that hypothesis

The Age tests the null hypothesis that age does not affect the growth rate.

As we can see, we reject the null hypothesis as the F-value is large.

The Age*gender tests reveals that there is a difference in slope at the 1% significance level.Slide57

Repeated Measures ANOVA vs. Independent Measures ANOVA

Magarate

BrownSlide58

Can we just use standard ANOVA with repeated measures data?

No, Independent Measures (standard) ANOVA assumes the data are independent.

Data from a repeated measures experiment

 not independentSlide59

How are standard ANOVA and repeated measures ANOVA the same?

Independent measures ANOVA: an extension of the pooled variance t-test

Repeated Measures ANOVA: an extension of the paired sample t-testSlide60

How are standard ANOVA and repeated measures ANOVA the same?

Independent measures ANOVA: assumes the population variances are equal (

homogeneity of variance

)

Repeated Measures ANOVA:

sphericity

assumption that the population variances of all the differences are equalSlide61

How are standard ANOVA and repeated measures ANOVA the same?

Both assume Normality of the populationSlide62

Advantages to using Repeated Measures instead of Independent Measures

Limited number of subjects available

Prefer to limit the number of subjects

Less variability (finger tapping with caffeine example)

Can examine effects over timeSlide63

Drawbacks

Practice effect

Example: subjects get better at performing a task each time with “practice”

Differential transfer: “This

occurs when the effects of one condition persist and affect participants’ experiences during subsequent conditions

.” (format: http://www.psychmet.com/id16.html)

Example: medical treatmentsSlide64

Resources (to be formatted)

http://www.psychmet.com/id16.html

http://www.utexas.edu/courses/schwab/sw388r7_spring_2007/SolvingProblemsInSPSS/Solving%20Repeated%20Measures%20ANOVA%20Problems.pdf

http://en.wikipedia.org/wiki/Repeated_measures

http://www.mhhe.com/socscience/psychology/shaugh/ch07_summary.html