Rank Tests
Geert Molenberghs
Table of contents
1
Rank Tests
Wilcoxon Rank Sum Test
Kruskal-Wallis Test
Friedmann Statistic
Sign Test
Jonckheere-Terpstra Test
Doctoral School Medicine
Introductory Example
1
107
87
2
102
97
3
95
101
4
106
113
5
112
80
Question: Does the mean blood pressure before surgery exceed the
mean blood pressure two months after surgery ?
Classical Approach
Paired t-test:
Patient
Before surgery
After surgery
Difference Di
1
107
87
20
Hypotheses: H0 : d = 0
2
102
97
5
versus
3
95
101
-6
4
106
113
-7
5
112
80
32
H1 : d > 0
1
n(n1)
D
P
(Di D)2
Assumptions
Normality is questionable !
Doctoral School Medicine
0.83
1.15
1.89
0.88
1.04
0.90
1.45
0.74
1.38
1.21
1.91
Statistical Methods:
t-test
Wilcoxon Rank Sum Test
1.64
1.46
22
78
37
27
172
28
47
286
38
Statistical Methods:
ANOVA
Kruskal-Wallis Test
58
915
20
72
84
68
56
153
12
1
186
188
2
171
177
3
177
176
4
168
169
5
191
196
6
172
172
7
177
165
8
191
190
9
170
165
Statistical Methods:
Paired t-test
Sign test; Signed-rank test
10
171
180
11
188
181
12
187
172
1
23.1
22.7
22.5
22.6
2
57.6
53.2
53.7
53.1
3
10.5
9.7
10.8
8.3
4
23.6
19.6
21.1
21.6
5
11.9
13.8
13.7
13.3
6
54.6
47.1
39.2
37.0
Statistical Methods:
Mixed Models
Friedmann test
Doctoral School Medicine
7
21.0
13.6
13.7
14.8
8
20.3
23.6
16.3
14.8
Ordered Treatments
Patients were treated with a drug a four dose levels (100mg,
200mg, 300mg and 400mg) and then monitored for toxicity.
Dose
100mg
200mg
300mg
400mg
Mild
100
18
50
50
Drug Toxicity
Moderate Severe Drug Death
1
0
0
1
1
0
1
1
0
1
1
1
Statistical Methods:
Regression
Jonckheere-Terpstra Test
Detailed Example:
Data : GAF scores
Control
Treatment
25
36
10
26
35
40
1 X
0
X
SX1 X0 ,
r
where SX1 X0 =
s2
1
n1
s
+ n0
25
36
10
26
35
40
WS = S1 + S2 + . . . + Sn
Ranks
Control
Treatment
(25)
(10)
(35)
(36)
(26)
(40)
WS = 5+3+6 =14
Doctoral School Medicine
treatment
ws
treatment
w
treatment
ws
treatment
ws
ranks
ranks
ranks
ranks
(4,5,6)
15
(2,4,6)
12
(1,5,6)
12
(1,3,4)
8
(3,5,6)
14
(2,4,5)
11
(1,4,6)
11
(1,2,6)
9
(3,4,6)
13
(2,3,6)
11
(1,4,5)
10
(1,2,5)
8
(3,4,5)
12
(2,3,5)
10
(1,3,6)
10
(1,2,4)
7
(2,5,6)
13
(2,3,4)
9
(1,3,5)
9
(1,2,3)
6
10
11
12
13
14
15
1
20
1
20
2
20
3
20
3
20
3
20
3
20
2
20
1
20
1
20
= 184756
= 924
T E (T )
p
a
Var (T )
!
(a)
where (a) is the area to the left of a under a standard normal curve
1
12 nm(N
+ 1)
Kruskal-Wallis Test
Method 2
94
90
81
Method 3
101
100
93
102
Small F:
Large F:
X1 = 89, X2 = 88.33, X3 = 99
1 = 3.56, 2 = 6.65, 3 = 4.08
MSTR= 135.03 , MSE = 22.08
F= 6.11
PH0 (F 6.11) = 0.0245
Ranks:
Ri. :
Method 1
6
5
1
3
3.75
Method 2
8
4
2
4.666
Method 3
10
9
7
11
6.75
Hypothesis :
H0 : No difference between the treatments
H1 : Any difference between the treatments
If treatments do not differ widely (H0 ):
Ri. are close to each other
Ri. close to R..
K=
X
12
ni (Ri. R.. )2
N(N + 1)
i=1
PH0 (K c) = ?
Exact distribution of K under H0 :
ranks are determined before assignment to treatment
random assignment all possibilities same chance of being
observed
Number
7 4 combinations: multinomial coefficient :
of11possible
11
3 4 = 11550
4,3,4 = 4
N
N Nn1
s1
. . . Nn1 ...n
n2
ns
n1 ,n2 ,...,ns = n1
Method 2
(5,6,7)
(4,6,7)
(4,5,6)
(4,5,6)
Method 3
(8,9,10,11)
(8,9,10,11)
(8,9,10,11)
(8,9,10,11)
K
8.91
8.32
7.84
7,48
(2,4,8)
(7,9,10,11)
6.16
1
11550
to happen.
Exact Distribution of K :
Friedmann Test
Friedmann Statistic
Setting 1: complete randomization:
Kruskal-Wallis test p-value =0.8611
Treatment effect is blurred by the variability between subjects
Procedure
Example
Data
treatment 20-30 y
A
19
B
17
C
23
Age-group
30-40 y 40-50 y
21
43
20
37
22
39
50-60 y
46
44
42
treatment 20-30 y
A
2
B
1
C
3
Age-group
30-40 y 40-50 y
2
3
1
1
3
2
50-60 y
3
2
1
reject H0
accept H0
Q=
12N X
(Ri. R.. )2
s(s + 1)
i=1
PH0 (Q c) =?
20-30 y
1
2
3
3
2
1
1
2
3
2
1
3
Age-group
30-40 y
40-50 y
1
1
2
2
3
3
3
3
2
2
1
1
3
1
2
2
1
3
2
1
3
3
1
2
Q
50-60 y
1
2
3
3
2
1
3
2
1
3
2
1
3.5
Exact Distribution of Q:
Q
Pr
.0000000 .694444444444444E-01
.5000000 .277777777777778
1.500000 .222222222222222
2.000000 .157407407407407
3.500000 .148148148148148
4.500000 .555555555555555E-01
6.000000 .277777777777778E-01
6.500000 .370370370370370E-01
8.000000 .462962962962963E-02
1
1296
Sign Test
Sign Test
Special case of Friedmann test: blocks of size 2
subjects matched on e.g. age, gender, ...
twins
two eyes (hands) of a person
subject serves as own control: e.g. blood pressure before and after treatment
Example: Pain scores for lower back pain, before and after
having acupuncture
Patient
1
2
3
4
5
6
7
Pain score
Before
5
6
7
9
6
5
4
Pain score
After
6
7
6
4
7
4
8
Sign
+
+
+
-
Patient
8
9
10
11
12
13
14
15
Pain score
Before
7
6
5
8
8
7
8
6
Pain score
After
6
5
7
6
4
3
5
7
Sign
+
+
+
+
+
+
-
Sign Test: SN = 9
PH0 (SN 9) =???
Exact Distribution of SN under H0 is binomial
N trials, N = number of pairs
Success probability: 12
N 1
PH0 (SN = a) =
a 2N
1
15
15
PH0 (SN 9) = ( 15
9 + 10 + . . . + 15 ) 215 = 0.31
Jonckheere-Terpstra Test
Jonckheere-Terpstra Test
To be used when the H1 is ordered.
Ordinal data for the responses and an ordering in the
treatment/groups.
Example:
Data:
Three diets for rats
Response: growth
H1 : Growth rate decreases from A to C : A B C
A
B
C
133
111
99
139
125
114
149
143
116
160
148
127
184
157
146
Jonckheere-Terpstra Test
Based on Mann-Whitney statistics for two treatments
Comparing the treatment groups two by two
if WBA is large: growth A > growth B :
if WBC is large: growth B > growth C :
if WCA is large: growth A > growth C :
(WBA = 18
(WBC = 18
(WBA = 23
P
JT Statistic: W = i<j Wij
Reject H0 when W is sufficiently large
W = 59
PH0 (W c) = 0.0120
Compare with the result of a Kruskal-Wallis Test: p-value =
0. 072
The distribution of W follows a normal distribution for large
samples
Doctoral School Medicine
(unless the
(uses ranks)
Can be used for data which are inherently in ranks, even for
data measured in a nominal scale
Easier to learn
Doctoral School Medicine