22
Hierarchical (nested) ANOVA

Hierarchical (nested) ANOVA

  • Upload
    tola

  • View
    104

  • Download
    2

Embed Size (px)

DESCRIPTION

Hierarchical (nested) ANOVA. Hierarchical ANOVA. Hierarchical (nested) ANOVA. In some two-factor experiments the level of one factor , say B, is not “cross” or “cross classified” with the other factor, say A, but is “NESTED” with it. The levels of B are different for different levels of A. - PowerPoint PPT Presentation

Citation preview

Page 1: Hierarchical (nested) ANOVA

Hierarchical (nested) ANOVA

Page 2: Hierarchical (nested) ANOVA

Hierarchical (nested) ANOVA

• In some two-factor experiments the level of one factor , say B, is not “cross” or “cross classified” with the other factor, say A, but is “NESTED” with it.

• The levels of B are different for different levels of A.– For example: 2 Areas (Study vs Control)

• 4 sites per area, each with 5 replicates.• There is no link from any sites on one area to any sites o

n another area.

Hierarchical ANOVA

Page 3: Hierarchical (nested) ANOVA

• That is, there are 8 sites, not 2.

Study Area (A) Control Area (B)

S1(A) S2(A) S3(A) S4(A) S5(B) S6(B) S7(B) S8(B)

X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X

X = replications

Number of sites (S)/replications need not be equal with each sites. Analysis is carried out using a nested ANOVA not a two-way ANOVA.

Hierarchical ANOVA

Page 4: Hierarchical (nested) ANOVA

• A Nested design is not the same as a two-way ANOVA which is represented by:

A1 A2 A3

B1 X X X X X X X X X X X X X X X

B2 X X X X X X X X X X X X X X X

B3 X X X X X X X X X X X X X X X

Nested, or hierarchical designs are very common in environmental effects monitoring studies. There are several “Study” and several “Control” Areas.

Hierarchical ANOVA

Page 5: Hierarchical (nested) ANOVA

Objectives

• The nested design allows us to test two things: (1) difference between “Study” and “Control” areas, and (2) the variability of the sites within areas.

• If we fail to find a significant variability among the sites within areas, then a significant difference between areas would suggest that there is an environmental impact.

• In other words, the variability is due to differences between areas and not to variability among the sites.

Hierarchical ANOVA

Page 6: Hierarchical (nested) ANOVA

• In this kind of situation, however, it is highly likely that we will find variability among the sites.

• Even if it should be significant, however, we can still test to see whether the difference between the areas is significantly larger than the variability among the sites with areas.

Hierarchical ANOVA

Page 7: Hierarchical (nested) ANOVA

Statistical Model

Yijk = + i + (i)j + (ij)k

i indexes “A” (often called the “major factor”)

(i)j indexes “B” within “A” (B is often called the “minor factor”)

(ij)k indexes replication

i = 1, 2, …, M

j = 1, 2, …, m

k = 1, 2, …, n

Hierarchical ANOVA

Page 8: Hierarchical (nested) ANOVA

Model (continue)

kijijk

ji

kiij

jiki

jikijk

ji

ijijkiijiijk

YY

YYYYYY

YYYYYYYY

2.

2...

2..

2

......

and

Hierarchical ANOVA

Page 9: Hierarchical (nested) ANOVA

Model (continue)

Or,

TSS = SSA + SS(A)B+ SSWerror

=

Degrees of freedom:

M.m.n -1 = (M-1) + M(m-1) + Mm(n-1)

n

kijijk

m

j

M

i

m

jiij

M

i

M

ii YYYYnYYnm

1

2.

111

2...

11

2...

Hierarchical ANOVA

Page 10: Hierarchical (nested) ANOVA

Example

M=3, m=4, n=3; 3 Areas, 4 sites within each area, 3 replications per site, total of (M.m.n = 36) data points

M1 M2 M3 Areas

1 2 3 4 5 6 7 8 9 10 11 12 Sites10 12 8 13 11 13 9 10 13 14 7 10

14 8 10 12 14 11 10 9 10 13 9 7 Repl.

9 10 12 11 8 9 8 8 16 12 5 4

11 10 10 12 11 11 9 9 13 13 7 7

10.75 10.0 10.0

10.25

.ijY

..iY

Y

Hierarchical ANOVA

Page 11: Hierarchical (nested) ANOVA

Example (continue)

SSA = 4 x 3 [(10.75-10.25)2 + (10.0-10.25)2 + (10.0-10.25)2]

= 12 (0.25 + 0.0625 + 0.625) = 4.5

SS(A)B = 3 [(11-10.75)2 + (10-10.75)2 + (10-10.75)2 + (12-10.75)2 +

(11-10)2 + (11-10)2 + (9-10)2 + (9-10)2 +

(13-10)2 + (13-10)2 + (7-10)2 + (7-10)2]

= 3 (42.75) = 128.25

TSS = 240.75

SSWerror= 108.0

Hierarchical ANOVA

Page 12: Hierarchical (nested) ANOVA

ANOVA Table for ExampleNested ANOVA: Observations versus Area, SitesSource DF SS( 平方和 ) MS( 方差 ) F PArea 2 4.50 2.25 0.158 0.856Sites (A)B 9 128.25 14.25 3.167 0.012**Error 24 108.00 4.50Total 35 240.75

What are the “proper” ratios?

E(MSA) = 2 + V(A)B + VA

E(MS(A)B)= 2 + V(A)B

E(MSWerror) = 2

= MSA/MS(A)B

= MS(A)B/MSWerror

Hierarchical ANOVA

Page 13: Hierarchical (nested) ANOVA

Summary

• Nested designs are very common in environmental monitoring

• It is a refinement of the one-way ANOVA• All assumptions of ANOVA hold: normality of resi

duals, constant variance, etc.• Can be easily computed using SAS, MINITAB, et

c.• Need to be careful about the proper ratio of the

Mean squares.• Always use graphical methods e.g. boxplots and

normal plots as visual aids to aid analysis.

Hierarchical ANOVA

Page 14: Hierarchical (nested) ANOVA

Sample: Hierarchical (nested)

ANOVA

58.5 1 159.5 1 177.8 2 180.9 2 184.0 3 183.6 3 170.1 4 168.3 4 169.8 1 269.8 1 256.0 2 254.5 2 250.7 3 249.3 3 263.8 4 265.8 4 256.6 1 357.5 1 377.8 2 379.2 2 369.9 3 369.2 3 362.1 4 364.5 4 3

Length mosquito cageHierarchical ANOVA

Page 15: Hierarchical (nested) ANOVA

Length = β0 + βcage ╳ cage + βmosquito(cage) ╳ mosquito (cage) + error

df?

Hierarchical ANOVA

Page 16: Hierarchical (nested) ANOVA

data anova6;input length mosquito cage;cards;58.5 1 159.5 1 177.8 2 180.9 2 184.0 3 183.6 3 170.1 4 168.3 4 169.8 1 269.8 1 256.0 2 254.5 2 250.7 3 249.3 3 263.8 4 265.8 4 256.6 1 357.5 1 377.8 2 379.2 2 369.9 3 369.2 3 362.1 4 364.5 4 3;

proc glm data=anova6;class cage mosquito;model length = cage mosquito(cage);test h=cage e=mosquito(cage);output out = out1 r=res p=pred;proc print data=out1;var res pred;proc plot data = out1;plot res*pred;proc univariate data=out1 normal plot;var res;run;

Hierarchical ANOVA

Page 17: Hierarchical (nested) ANOVA

Class Levels Values

mosquito 4 1 2 3 4

cage 3 1 2 3

Number of observations 24

Hierarchical ANOVA

Page 18: Hierarchical (nested) ANOVA

Sum of Source DF Squares Mean Square F Value Pr > F

Model 11 2386.353333 216.941212 166.66 <.0001 Error 12 15.620000 1.301667 Corrected Total 23 2401.973333

Source DF Type I SS Mean Square F Value Pr > F

cage 2 665.675833 332.837917 255.70 <.0001mosquito(cage) 9 1720.677500 191.186389 146.88 <.0001

Tests of Hypotheses Using the MS for mosquito(cage) as an Error Term

Source DF Type I SS Mean Square F Value Pr > Fcage 2 665.675833 332.837917 1.74 0.2295

Hierarchical ANOVA

Page 19: Hierarchical (nested) ANOVA

- 2- 1. 5- 1

- 0. 50

0. 51

1. 52

- 2 - 1. 5 - 1 - 0. 5 0 0. 5 1 1. 5 2

res

res1

Hierarchical ANOVA

Page 20: Hierarchical (nested) ANOVA

pred

res

- 2

- 1

0

1

2

45 55 65 75 85

Hierarchical ANOVA

Page 21: Hierarchical (nested) ANOVA

Tests for Normality

Test --Statistic--- -----p Value------

Shapiro-Wilk W 0.978828 Pr < W 0.8733 Kolmogorov-Smirnov D 0.093842 Pr > D >0.1500 Cramer-von Mises W-Sq 0.038078 Pr > W-Sq >0.2500 Anderson-Darling A-Sq 0.22057 Pr > A-Sq >0.2500

Hierarchical ANOVA

Page 22: Hierarchical (nested) ANOVA

Two way ANOVA

vs. nested ANOVA

Hierarchical ANOVA