Analysis of Variances

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 17

Analysis of Variance

ANOVA
ANOVA
for comparing means between more
than 2 groups
Types of Experimental Designs

Experimental
Designs

Completely Randomized Factorial


Randomized Block

One- Two-
Way Way
Anova Anova
EPI809/Spring 2008 3
Hypothesis of One-Way ANOVA

H0: 1 = 2 = 3 = ... = p
 All Population Means are f(X)
Equal
 No Treatment Effect
X
Ha: Not All j Are Equal 1 = 2 = 3
 At Least 1 Pop. Mean is
Different f(X)
 Treatment Effect
 NOT 1 = 2 = ... = p
 Or i ≠ j for some i, j. X
1 =  2  3
EPI809/Spring 2008 4
How to calculate ANOVA’s by hand…

Treatment 1 Treatment 2 Treatment 3 Treatment 4


y11 y21 y31 y41
y12 y22 y32 y42 n=10 obs./group
y13 y23 y33 y43
k=4 groups
y14 y24 y34 y44
y15 y25 y35 y45
y16 y26 y36 y46
y17 y27 y37 y47
y18 y28 y38 y48
y19 y29 y39 y49
y110 y210 y310 y410
10

y
10 10 10

1j y 2j y 3j y 4j The group means


j 1 j 1
y1  y 2 
j 1
y 3 
j 1 y 4 
10 10 10 10

10

(y
10 10

 
10
 y 2 )

2
( y1 j  y1 ) 2 2j ( y 3 j  y 3 ) 2 ( y 4 j  y 4 ) 2
The (within) group
j 1 j 1 j 1 j 1
variances
10  1 10  1 10  1 10  1
Sum of Squares Within (SSW), or
Sum of Squares Error (SSE)
10

(y
10 10

(y (y
10
 y 2 )
(y
2
1j  y1 ) 2 2j 3j  y 3 ) 2
4j  y 4 ) 2
j 1 j 1 j 1 j 1
The (within) group
variances
10  1 10  1 10  1 10  1

10 10

 (y
10 10

(y  ( y 3 j  y 3 ) +  y 4 ) 2
2
 y1 ) +
2 ( y 2 j  y 2 ) 2 + 4j
1j
j 1 j 3 j 1
j 1

4 10
  i 1 j 1
( y ij  y i ) 2 Sum of Squares Within (SSW)
(or SSE, for chance error)
Sum of Squares Between (SSB), or Sum
of Squares Regression (SSR)

4 10
Overall mean of
all 40  y
i 1 j 1
ij
observations
(“grand mean”) y  
40

(y
Sum of Squares Between

 y  ) 2 (SSB). Variability of the


10 x i group means compared to
the grand mean (the
i 1 variability due to the
treatment).
Total Sum of Squares (SST)

Total sum of squares(TSS).


4 10


Squared difference of every

( y ij  y  ) 2 observation from the overall


mean. (numerator of
variance of Y!)
i 1 j 1
Partitioning of Variance

4 10 4 4 10
 ( y
i 1 j 1
ij  y i ) 2

+ 10x ( y i   y  ) 2
=  ( y ij  y  ) 2
i 1 i 1 j 1

SSW + SSB = TSS


ANOVA Table
Mean Sum
Source of Sum of of Squares
variation d.f. squares F-statistic

Between k-1 SSB SSB/k-1 SSB


(sum of squared k 1
(k groups) SSW
deviations of nk  k
group means from
grand mean)

Within nk-k SSW s2=SSW/nk-k


(sum of squared
(n individuals per
deviations of
group)
observations from
their group mean)

Total nk-1 TSS


variation (sum of squared deviations of
observations from grand mean) TSS=SSB + SSW
Example

Treatment 1 Treatment 2 Treatment 3 Treatment 4


60 inches 50 48 47
67 52 49 67
42 43 50 54
67 67 55 67
56 67 56 68
62 59 61 65
64 67 61 65
59 64 60 56
72 63 59 60
71 65 64 65
Example

Step 1) calculate the sum


of squares between groups:
Treatment 1 Treatment 2 Treatment 3 Treatment 4
60 inches 50 48 47
67 52 49 67
42 43 50 54
Mean for group 1 = 62.0 67 67 55 67

Mean for group 2 = 59.7 56 67 56 68


62 59 61 65
Mean for group 3 = 56.3 64 67 61 65
59 64 60 56
Mean for group 4 = 61.4 72 63 59 60
71 65 64 65

Grand mean= 59.85

SSB = [(62-59.85)2 + (59.7-59.85)2 + (56.3-59.85)2 + (61.4-59.85)2 ] xn per


group= 19.65x10 = 196.5
Example
Treatment Treatment Treatment Treatment
1 2 3 4

Step 2) calculate the sum of 60 inches 50 48 47

squares within groups: 67 52 49 67

42 43 50 54

(60-62) 2+(67-62) 2+ (42-62) 2+ (67-


67 67 55 67

62) 2+ (56-62) 2+ (62-62) 2+ (64-62) 56 67 56 68


2+ (59-62) 2+ (72-62) 2+ (71-62) 2+
62 59 61 65
(50-59.7) 2+ (52-59.7) 2+ (43-59.7) 64 67 61 65
2+67-59.7) 2+ (67-59.7) 2+ (69-59.7)
2…+….(sum of 40 squared 59 64 60 56

deviations) = 2060.6 72 63 59 60

71 65 64 65
Step 3) ANOVA table

Source of variation d.f. Sum of squares Mean Sum of F-statistic


Squares

Between 3 196.5 65.5 1.14

Within 36 2060.6 57.2

Total 39 2257.1
Step 3) ANOVA table

Source of variation d.f. Sum of squares Mean Sum of F-statistic


Squares

Between 3 196.5 65.5 1.14

Within 36 2060.6 57.2

Total 39 2257.1
Coefficient of Determination

SSB SSB
R 2

SSB  SSE SST
The amount of variation in the outcome variable (dependent
variable) that is explained by the predictor (independent variable).

INTERPRETATION of ANOVA:
How much of the variance in height is explained by treatment group?
R2=“Coefficient of Determination” = SSB/TSS = 196.5/2275.1=9%

You might also like