Nested ANOVA: Example Nested ANOVA: models

0 downloads 0 Views 37KB Size Report
3. 4. 1. 2. 3. 4. 58.5 77.8 84.0 70.1 69.8 56.0 50.7 63.8 56.6 77.8 69.9 62.1. 59.5 80.9 83.6 68.3 69.8 54.5 49.3 65.8 57.5 79.2 69.2 64.5. Nested ANOVA: models.
Nested ANOVA: Example • 3 cages • 4 mosquitoes within each cage • 2 independent measurements per mosquito Cage I 1

2

Cage II

3

4

58.5 77.8 84.0 70.1 59.5 80.9 83.6 68.3

1

2

3

Cage III 4

1

69.8 56.0 50.7 63.8 69.8 54.5 49.3 65.8

2

3

4

56.6 77.8 69.9 62.1 57.5 79.2 69.2 64.5

Nested ANOVA: models Yijk = µ + αi + βij + ǫijk µ = overall mean αi = “effect” for ith cage βij = “effect” for jth mosquito within ith cage ǫijk = random error

Random effects model αi ∼ Normal(0, σA2 )

Mixed effects model αi fixed;

P

αi = 0

βij ∼ Normal(0, σB2 |A)

βij ∼ Normal(0, σB2 |A)

ǫijk ∼ Normal(0, σ 2)

ǫijk ∼ Normal(0, σ 2)

The model

40

50

60

70

80

90

40

50

60

Cages

−30

−20

−10

0

10

20

30

−30

−20

−10

Individuals

−30

−20

−10

0

70

80

90

100

Cages

0

10

20

30

10

20

30

Individuals

10

20

30

−30

−20

Residuals

−10

0

Residuals

Example: sample means Cage I 1

¯ ij· Y ¯ i·· Y ¯ ··· Y

2

3

Cage II 4

1

2

3

Cage III 4

1

2

3

4

58.5 77.8 84.0 70.1 59.5 80.9 83.6 68.3

69.8 56.0 50.7 63.8 69.8 54.5 49.3 65.8

56.6 77.8 69.9 62.1 57.5 79.2 69.2 64.5

59.00

69.80

57.05

79.35

83.80

72.84

69.20

55.25

50.00

59.96 66.63

64.80

78.50

69.55

67.10

63.30

Calculations (equal sample sizes) Source

Sum of squares

among groups

SSamong = bn

subgroups within groups

SSsubgr = n

within subgroups

SSwithin =

TOTAL

PPP i

j

df

P ¯ ¯ 2 i (Yi·· − Y··· )

PP ¯ ¯ 2 i j (Yij· − Yi·· )

PPP i

j

k (Yijk

k (Yijk

¯ ij·)2 −Y

¯ ···)2 −Y

a–1

a (b – 1)

a b (n – 1)

abn–1

ANOVA table SS

df

MS

F

expected MS

SSamong

a–1

SSamong a–1

MSamong MSsubgr

σ 2 + n σB2 |A + n b σA2

SSsubgr

a (b – 1)

SSsubgr a(b – 1)

MSsubgr MSwithin

σ 2 + n σB2 |A

SSwithin

a b (n – 1)

SSwithin ab(n – 1)

SStotal

abn–1

σ2

Example source

df

SS

MS

F

P-value

among groups

2

665.68

332.84

1.74

0.23

among subgroups within groups

9

1720.68

191.19

146.88

< 0.001

within subgroups

12

15.62

1.30

TOTAL

23

2401.97

aov.out