One-Way ANOVA & Kruskal-Wallis Test: DR Elaine Chan Wan Ling
One-Way ANOVA & Kruskal-Wallis Test: DR Elaine Chan Wan Ling
Kruskal-Wallis Test
One-way ANOVA (1)
• used to test the claim that three or more population means are equal
• Recall that T Test is for 2 samples comparison
• Null : μ1 = μ2 = μ3
• Alternative : μ1 ≠ μ2 ≠ μ3
↑ F value, ↓ P value
• Significant when variance between
groups > variance within group
Compare the household income
between Johor, Malacca and
Selangor
Example of
• Household income = Responding variables
• State = Factor
one-way
ANOVA
Compare the sodium level of Chips
Brand X, Y and Z
• Variance is equal
o Can be tested using Levene Test
A resulting p-value under 0.05 means that variances are not equal
Limitation of • Example:
• Difference of IQ across gender <- One-way ANOVA
One-way • Difference of IQ across gender and age group <-
Factorial ANOVA
ANOVA
ANOVA is an omnibus test
• Significant P imply that at least one pairing is different,
but the test will not tell which pair(s) is/are different
• E.g A vs B; B vs C; Avs C <- At least one pairing is
different, Need post hoc test
ANOVA using Rcmdr
“chickwts” data recorded the chicken weight under different type of feeds
Check for normality
Anderson-Darling Test
Anderson-Darling Test
p-values adjusted by the Holm method:
unadjusted adjusted
casein 0.31428 1.00000
horsebean 0.50740 1.00000
linseed 0.90782 1.00000 > 0.05, Data is normally
distributed
meatmeal 0.88799 1.00000
soybean 0.53242 1.00000
sunflower 0.14775 0.88649
Check for equal variances
Levene Test
Levene’s Test
> leveneTest(weight ~ feed, data=chickwts, center="median")
Levene's Test for Homogeneity of Variance (center = "median")
Df F value Pr(>F)
group 5 0.7493 0.5896 > 0.05, Variance is equal
65
One-way ANOVA (1)
One-way ANOVA (2)
Pairwise Test
If Levene is significant
Result (1)
• > summary(AnovaModel.1) At least one group is
• Df Sum Sq Mean Sq F value Pr(>F) significant
Hypothesis
Test for normality
• Conduct Anderson-Darling Test
data: N by Contour
Kruskal-Wallis chi-squared = 2.5739, df = 2, p-value = 0.2761
Result (2)
• Accept null
• No difference in soil N between top, slope, and depression.
Thank you