Chapter Three
One-Way Analysis of Variance
(ANOVA)
Name: Huruy Assefa
E-mail: huruyame@[Link]
Mob.: 0914-728565
Office:B1-303
School of Public Health
One-Way ANOVA F-Test
1. Tests the Equality of 2 or More Population
Means
2. Variables
– One Nominal Independent Variable
– One Continuous Dependent Variable
School of Public Health
Assumptions
1. Randomness & Independence of Errors
2. Normality
– Populations (for each condition) are Normally
Distributed
3. Homogeneity of Variance
– Populations (for each condition) have Equal
Variances
School of Public Health
One-Way ANOVA F-Test Hypotheses
• H0: 1 = 2 = 3 = ... = p
– All Population Means are Equal
– No Treatment Effect
• Ha: Not All j Are Equal
– At Least 1 Pop. Mean is Different
– Treatment Effect
– NOT 1 2 ... p
Basic Idea
1. Compares 2 Types of Variation to Test
Equality of Means
2. If Treatment Variation Is Significantly Greater Than
Random Variation then Means Are Not Equal
[Link] Measures Are Obtained by ‘Partitioning’ Total
Variation
School of Public Health
One-Way ANOVA
Partitions Total Variation
One-Way ANOVA
Partitions Total Variation
Total variation
One-Way ANOVA
Partitions Total Variation
Total variation
Variation due to
treatment
One-Way ANOVA
Partitions Total Variation
Total variation
Variation due to Variation due to
treatment random sampling
One-Way ANOVA
Partitions Total Variation
Total variation
Variation due to Variation due to
treatment random sampling
Sum of Squares Among
Sum of Squares Between
Sum of Squares Treatment
Among Groups Variation
One-Way ANOVA
Partitions Total Variation
Total variation
Variation due to Variation due to
treatment random sampling
Sum of Squares Among
Sum of Squares Between Sum of Squares Within
Sum of Squares Treatment Sum of Squares Error (SSE)
(SST)
Within Groups Variation
Among Groups Variation
Cont.
• Total Variation
SS Total Y11 Y Y21 Y Yij Y
2 2 2
• Treatment Variation
SST n1 Y1 Y n2 Y2 Y n p Yp Y
2 2 2
• Random (Error) Variation
SSE Y11 Y1 Y21 Y2 Ypj Yp
2 2 2
School of Public Health
Test Statistic
1. Test Statistic
SST / p 1
F = MST / MSE
SSE / n p
• MST Is Mean Square for Treatment
• MSE Is Mean Square for Error
2. Degrees of Freedom
p -1 = Degree of freedom for Treatment
n – p= Degree of freedom for Error
• p = # Populations, Groups, or Levels
• n = Total Sample Size
School of Public Health
One-Way ANOVA
Summary Table
Source of Degrees Sum of Mean F
Variation of Squares Square
Freedom (Variance)
Treatment p-1 SST MST = MST
SST/(p - 1) MSE
Error n-p SSE MSE =
SSE/(n - p)
Total n-1 SS(Total) =
SST+SSE
One-Way ANOVA F-Test Critical Value
Reject H 0
Do Not
Reject H 0
0 F
Fa ( p 1, n p )
Always One-Tail!
School of Public Health
HOW TO CALCULATE ANOVA’S BY HAND…
Treatment 1 Treatment 2 Treatment 3 Treatment 4
y11 y21 y31 y41
y12 y22 y32 y42
y13 y23 y33 y43
y14 y24 y34 y44 n=10 obs./group
y15 y25 y35 y45
y16 y26 y36 y46 k=4 groups
y17 y27 y37 y47
y18 y28 y38 y48
y19 y29 y39 y49
y110 y210 y310 y410
10
10 10 10
y1 j
y 2j y3 j y 4j The group means
j 1 j 1
y1 y 2
j 1
y 3
j 1 y 4
10 10 10 10
School of Public Health
Sum of Squares Within (SSW)
10
(y
10 10
(y (y
10
y 2 )
(y
2
y1 ) 2 2j y 3 ) 2
y 4 ) 2
The (within)
1j 3j 4j
j 1 j 1 j 1 j 1
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)
4 10
Overall mean
of all 40
y
i 1 j 1
ij
observations
(“grand mean”)
y
40
(y
Sum of Squares Between
10x i y ) 2 (SSB). Variability of the
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
i 1 j 1
( yij y ) 2 every observation from the
overall mean. (numerator
of variance of Y!)
Partitioning of Variance
4 10 4 4 10
( y
i 1 j 1
ij y i ) 2
+
10x
( y i y ) 2 = ( yij 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 p-value
Between k-1 SSB SSB/k-1 Go to
SSB
(sum of squared k 1
(k groups) SSW Fk-1,nk-k
deviations of group nk k chart
means from grand
mean)
Within nk-k SSW s 2=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
Mean for group 1 = 62.0 67 52 49 67
42 43 50 54
Mean for group 2 = 59.7 67 67 55 67
56 67 56 68
Mean for group 3 = 56.3 62 59 61 65
Mean for group 4 = 61.4 64 67 61 65
59 64 60 56
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
Step 2) calculate the sum
Treatment 1 Treatment 2 Treatment 3 Treatment 4
of squares within groups:
60 inches 50 48 47
67 52 49 67
(60-62) 2+(67-62) 2+ (42-62) 42 43 50 54
2+ (67-62) 2+
(56-62) 2+ (62-
62) 2+ (64-62) 2+ (59-62) 2+ 67 67 55 67
(72-62) 2+ (71-62) 2+ (50- 56 67 56 68
59.7) 2+ (52-59.7) 2+ (43- 62 59 61 65
59.7) 2+67-59.7) 2+ (67-
59.7) 2+ (69-59.7)
64 67 61 65
2…+….(sum of 40 squared 59 64 60 56
deviations) = 2060.6 72 63 59 60
71 65 64 65
Fill in the ANOVA table
Source of d.f. Sum of squares Mean Sum of F-statistic p-value
variation Squares
Between 3 196.5 65.5 1.14 .344
Within 36 2060.6 57.2
Total 39 2257.1
Fill in the ANOVA table
Source of d.f. Sum of squares Mean Sum of F-statistic p-value
variation Squares
3 196.5 65.5 1.14 0.344
Between
2060.6 57.2
Within 36
2257.1
Total 39
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%
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).
School of Public Health
Multiple Comparisons
• ANOVA only tells us if there is an effect
– That is, are the means of the groups not all equal?
• ANOVA does not tell us which means are
different from which other means
• Multiple comparisons are used to determine
which means are probably different from which
other means
School of Public Health
Multiple Comparisons
• Multiple comparisons are not fundamentally
different from performing a t-test
• That is, both multiple comparisons and t-tests
answer the same question:
are two means different from each other
• The difference is that the multiple comparisons
protect us from making a Type-I error even
though we perform many such comparisons
School of Public Health
Multiple Comparisons
• There are many types of multiple
comparison
• E.g:- Tukey, Newman-Keuls, Dunnett,
Scheffé, Bonferroni
School of Public Health
Tukey Tests
• The Tukey test offers reasonable
protection from Type-I errors while
maintaining reasonable statistical power
• You should perform Tukey tests only
when two criteria have been met:
– There are more than two levels to the IV
– The IV is statistically significant
School of Public Health
Steps in Performing Tukey Tests
• Write the hypotheses
– H0: 1 = 2
– H1: 1 2
• Specify the level
– = 0.05
School of Public Health
Steps in Performing Tukey Tests
Calculate the honestly significant difference (HSD)
MS withingroups
HSD q
, k ,df withingroup s n
q,k,dfwithin-groups = tabled q value
= level
k = number of levels of the IV
dfwithin-groups = degrees of freedom for MSwithin-groups
MSwithin-groups = within-groups variance estimate
n = number of participants
Steps in Performing Tukey Tests
• Take the difference of the means of the
conditions you are comparing
• If the difference of the means is at least
as large as the HSD, you can reject H0
• Repeat for whatever other comparisons
need to be made
School of Public Health