# Kruskal Wallis Test

```Statistical Methods II
Session 10
Non Parametric Testing –
The Kruskal-Wallis Test
Kruskal-Wallis Test
Recall what we know about ANOVA:
 Used when we want to test if the means of 3 or more
groups are different.
 Hypotheses are written as:
H0: The k level means are the same
H1: At least one of means is different
 Assumptions include:
1.
2.
3.
All the groups are normally distributed.
All the populations sampled have approximately equal variance
(you can check this by generating side-by-side boxplots).
The samples of the groups are independent of each other and
subjects within the groups were randomly selected.
Kruskal-Wallis Test
From these assumptions, what deviations should concern us
the most?
If the normality assumptions are not met AND we do not
have a balanced design, ANOVA is not an appropriate tool.
If these assumptions are violated, Plan B is the non
parametric alternative – The Kruskal-Wallis Test.
Kruskal-Wallis Test
Things to know about the K-W Test:
 It is a non-parametric alternative and therefore should
never be “Plan A”.
 Like all non-parametric tests, the focus is on ranks,
counting and the medians.
 The hypotheses statements are written as:
H0: All k populations have the same median.
H1: Not all of the k population medians are the same.
 As the ANOVA is a conceptual extension of the two
sample ttest, so the K-W test is a conceptual extension of
the Wilcoxon Rank Sum (Mann Whitney) test.
Kruskal-Wallis Test
Steps for the K-W Test:
1. Rank the entire dataset from highest to lowest. Handle
ties by assigning the average of the tied ranks to all
involved in the tie.
2. Compute Ti as the sum of the ranks for group i, for each
of the k groups.
3. The test statistic is: H={12/N(N+1)}Σni {Ri – ((1+N)/2)2}
Where,
N = the total number of obs in the sample
ni = the number of obs in group i
Ri = the average of the ranks in group i
Kruskal-Wallis Test
Consider the following example –
To assess the effects of expectation on the aesthetic quality,
an investigator randomly sorts 24 amateur wine aficionados
into three groups – A, B and C of 8 subjects each. Each
subject is scheduled for an individual interview to taste and
rate wines. The only difference among the three groups is
the expectations set regarding the quality of the wine (it’s
the same wine being tested across the groups). Group A is
told that the wine is of VERY fine quality, Group B is told that
the wine is medium quality and Group C is told that the
wine is of low quality. The wine will be ranked from 1 (low) to
10 (high).
Kruskal-Wallis Test
Unfortunately, on the day of the interviews, some people
don’t show up. By the end of the day, the researcher has
the following data:
GROUP A
(n=8)
GROUP B
(n=7)
GROUP C
(n=6)
6.4
2.5
1.3
6.8
3.7
4.1
7.2
4.9
4.9
8.3
5.4
5.2
8.4
5.9
5.5
9.1
8.1
8.2
9.4
8.2
9.7
Kruskal-Wallis Test
Lets execute this test using SAS…
```

26 cards

27 cards

38 cards

14 cards

12 cards