Professional Documents
Culture Documents
{
If we have three or
more populations to
compare we use
Kruskal Wallis
Test
Independent Samples
One-way ANOVA for a completely randomized design is based on the
assumption of normality and equality of variance.
The nonparametric alternative not relying on these assumptions is
called the Kruskal-Wallis Test.
Like the Mann-Whitney/Wilcoxon Rank Sum Test we use the sum of
the ranks assigned to each group when considering the combined
sample as the basis for our test statistic.
Kruskal-Wallis Test
Kruskal-Wallis Test
Basic Idea:
1) Looking at all observations together,
rank them.
2) Let R1, R2, ,Rk be the sum of the ranks
of each group
3) If some Ris are much larger than
others,
it indicates the response values in
different groups come from different
populations.
Kruskal-Wallis Test
12 k
Ri N 1
H
ni
N ( N 1) i 1 ni 2
~ k 1
2
where,
N = total sample size = n1 + n2 + ... + nk
Ri
average rank for group i
ni
N 1
average overall rank
2
Kruskal-Wallis Test
The test statistic is
12 k
Ri N 1
H
ni
N ( N 1) i 1 ni 2
~ k 1
2
12 R1 R2 Rk
H = ------------- ----- + ----- + + ------- - 3(N + 1)
N(N + 1) n1 n2 nk
where
Ri is the sum of the ranks of the ith sample
R1 is the sum of the ranks squared for the first sample
R2 is the sum of the ranks squared for the second sample, and so on
n1 is the number of observations in the first sample
n2 is the number of observations in the second sample, and so on
N is the total number of observations (N = n1 + n2 + + nk)
k is the number of populations being compared.
Chi-squared Distribution and p-
value
k21
Area = p-value
2
A clinical trial evaluating the fever reducing
effects of aspirin, ibuprofen, and
acetaminophen was conducted. Study subjects
were adults seen in an ER with diagnoses of flu
with body temperatures between 100o F and
100.9o F. Subjects were randomly assigned to
treatment. Changes in body temperature were
recorded
2 hrs. after administration of treatments.
Example: Kruskal-Wallis
Test
Example: Kruskal-Wallis
Test Resulting Data: Temperature Decrease (deg. F)
1.39 13 .62 7
-.39 1
(i.e. temp increase)
N = 15 R1 = 44 R2 = 50 R3 = 26
n1 = 4 n2 = 5 n3 = 6
N = 15 R1 = 44 H
12
k
R = 50
R N 1
ni i 2
R3 = 26
N ( N 1) i 1 ni 2
n1 = 4 12 44
n =5
15 21 50 15 1 26 15 1
n3 = 6
4 5 6
15(15 1) 4 2 5 2 6 2
6.833 ~ 22 i.e. chi - square distributi on with df 2
Example: Kruskal-Wallis
Test
Chi-squared Distribution and p-
value
6.833
Area = .033
2
2
Analyze > Fit Y by X
RESULTS
R1 = 44 n1 = 4
R2 = 50 n2 = 5
Kruskal-Wallis inR =JMP
26 n = 6
3 3
(Demo)
H = 6.833 df = 2
p = .033
Using the Kruskal-Wallis test have evidence to
suggest that the temperature changes after
taking the different drugs are not the same (p =
.033).
Decision/Conclusion
The Kruskal-Wallis test
ANOVA is based on the assumption of normality
There is a non-parametric alternative not relying this
assumption:
Looking at all observations together, rank them
Let R1, R2, ,RK be the sums of ranks of each group
If some Rs are much larger than others, it indicates the numbers
in different groups come from different populations
The Kruskal-Wallis test
The test statistic is
12 K
Ri2
W
n(n 1) i 1 ni
3(n 1)
K2 1
Kruskal-Wallis in SPSS
3
Total
4
13
6,38 Asymp. Sig. ,123
a. Kruskal Wallis Tes t
b. Grouping Variable: VAR00002