Anda di halaman 1dari 54

Why nonparametric methods What test to use ?

Rank Tests

Parametric and non-parametric statistical methods


for the life sciences - Session I
Liesbeth Bruckers

Geert Molenberghs

Interuniversity Institute for Biostatistics and statistical


Bioinformatics (I-Biostat)
Universiteit Hasselt
June 7, 2011

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Table of contents
1

Why nonparametric methods


Introductory example
Nonparametric test of hypotheses

What test to use ?


Two independent samples
More then two independent samples
Two dependent samples
More then two dependent samples
Ordered hypotheses

Rank Tests
Wilcoxon Rank Sum Test
Kruskal-Wallis Test
Friedmann Statistic
Sign Test
Jonckheere-Terpstra Test
Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Introductory example Nonparametric test of hypotheses

Why nonparametric methods ?

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Introductory example Nonparametric test of hypotheses

Introductory Example

The paper Hypertension in Terminal Renal Failure, Observations


Pre and Post Bilateral Nephrectomy (J. Chronic Diseases (1973):
471-501) gave blood pressure readings for five terminal renal
patients before and 2 months after surgery (removal of kidney).
Patient
Before surgery
After surgery

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 ?

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Introductory example Nonparametric test of hypotheses

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

d : mean difference in blood pressure


Test-Statistic : t =

1
n(n1)

D
P
(Di D)2

follows a t distribution with n 1 d.f.


Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Introductory example Nonparametric test of hypotheses

Assumptions

The statistic follows a t-distribution if the differences are


normally distributed t-test = parametric method
Observations are made independent: selection of a patient
does not influence chance of any other patient for inclusion
(Two sample t test): populations must have same variances
Variables must be measured in an interval scale, to interpret
the results
These assumptions are often not tested, but accepted.

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Introductory example Nonparametric test of hypotheses

Normal probability plot

Normality is questionable !
Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Introductory example Nonparametric test of hypotheses

Nonparametric Test of Hypotheses


Follow same general procedure as parametric tests:
State null and alternative hypothesis
Calculate the value of the appropriate test statistic (choice
based on the design of the study)
Decision rule: either reject or accept depending on the
magnitude of the statistic
PH0 (T c) = ??
Exact distribution
Approximation for the exact distribution

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

When to use what test

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

What test to use ?

Choice of appropriate test statistic depends on the design of the


study:
number of groups ?
independent of dependent samples ?
ordered alternative hypothesis ?

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

Two Independent Samples


Permeability constants of the human chorioamnion (a placental
membrane) for at term (x) and between 12 to 26 weeks gestational
age (y) pregnancies are given in the table below. Investigate the
alternative of interest that the permeability of the human
chorioamnion for a term pregnancy is greater than for a 12 to 26
weeks of gestational age pregnancy.
X (at term)
Y (12-26weeks)

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

Doctoral School Medicine

1.64

1.46

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

More Than Two Independent Samples


Protoporphyrin levels were determined for three groups of people a control group of normal workers, a group of alcoholics with
sideroblasts in their bone marrow, and a group of alcoholics
without sideroblasts. The data is shown below. Does the data
suggest that normal workers and alcoholics with and without
sideroblasts differ with respect to protoporphyrin level ?
Group
Normal
Alcoholics with sideroblasts
Alcoholics without sideroblasts

22
78
37

27
172
28

47
286
38

Protoporphyrin level (mg)


30
38
78
28
82
453
513
174
45
47
29
34

Statistical Methods:
ANOVA
Kruskal-Wallis Test

Doctoral School Medicine

58
915
20

72
84
68

56
153
12

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

Two Dependent Samples

Twelve adult males were put on liquid diet in a weight-reducing


plan. Weights were recorded before and after the diet. The data
are shown in the table below.
Subject
Before
After

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

Doctoral School Medicine

10
171
180

11
188
181

12
187
172

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

Randomized Blocked Design


Effect of Hypnosis:
Emotions of fear, happiness, depression and calmness were
requested (in random order) from 8 subject during hypnosis
Response: skin potential (in millivolts)
Subject
Fear
Happiness
Depression
Calmness

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

Why nonparametric methods What test to use ? Rank Tests

Two independent samples More then two independent samples

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Wilcoxon Rank Sum Test

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Wilxocon Rank Sum Test

Detailed Example:
Data : GAF scores
Control
Treatment

25
36

10
26

35
40

Does treatment improve the functioning ?

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Parametric Approach: t-test


t=

1 X
0
X
SX1 X0 ,

r
where SX1 X0 =

s2
1
n1

s
+ n0

t test: means of two normally distributed populations are


equal
H0 : 1 = 0
H1 : 1 6= 0 (one sided test H1 : 1 0

equal sample sizes


two distributions have the same variance
1 = 34.00, X
0 = 23.33, SX = 7.21, SX = 12.58
X
1
0
t = 1.27
PH0 (t 1.27) = 0.1358

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Wilxocon Rank Sum Test


Detailed Example:
Control
Treatment

25
36

10
26

35
40

Order data: Position of patients on treatment as compared


with position of patients in control arm ?
Ranks

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Treatment is effective if treated patients rank sufficiently


high in the combined ranking of all patients
Test statistic such that:
treatment ranks are high value test statistic is high
treatment ranks are low value test statistic is low

WS = S1 + S2 + . . . + Sn

(n=3, number of patients in treatment arm)

Ranks
Control
Treatment

(25)

(10)

(35)

(36)

(26)

(40)

WS = 5+3+6 =14
Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Reject null hypothesis when WS is sufficiently large : WS c


PH0 (WS c) = (alpha=0.05)
Distribution of WS under H0 ?
Suppose no treatment effect (H0 )
rank is solely determined by patients health status
rank is independent of receiving treatment or placebo
rank is assigned to patient before randomisation

Random selection of patients for treatment random


selection of 3 ranks out of 6
Randomisation divides ranks (1,2,...6) into two groups !

N!
Number of possible combinations : Nn = n!(Nn)!

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

All posibilities: (each as a probability of 1/20 under H0 )

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

Doctoral School Medicine

(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

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Distribution of WS under the null hypothesis:


w
PH0 (Ws = w )

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

PHO (WS 14) = 0.1


Do not reject H0 .
Conclusion: Treatment does not increase the GAF scores.
Power of this study ???

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Large Sample Size-case


N
n

increases rapidly with N and n


20
10
12
6

= 184756
= 924

Asymptotic Null Distribution: Central Limit Theorem


Sum T of large number of independent random variables is
approximately normally distributed.
P

T E (T )
p
a
Var (T )

!
(a)

where (a) is the area to the left of a under a standard normal curve

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

If both n and m are sufficiently large:


p
WS N(E (WS ); Var (WS ))
E (WS ) = 12 n(N + 1)
Var (WS ) =

1
12 nm(N

+ 1)

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Kruskal-Wallis Test

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Kruskal- Wallis test


Example: Kruskal- Wallis test:
The following data represent corn yields per acre from three
different fields where different farming methods were used.
Method 1
92
91
84
89

Method 2
94
90
81

Method 3
101
100
93
102

Question: is the yields different for the 4 methods ?

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Parametric Approach One-way ANOVA

Statistical test of whether or not the means of several groups


are all equal
Assumptions:
Independence of cases
The distributions of the residuals are normal : i (0, 2 ).
Homoscedasticity

variance between groups


= MSTR
MSE
variance within groups
Statistic follows a F distribution with s 1, n s d.f.
F =

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Small F:

Large F:

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

One-Way ANOVA results

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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..

If treatments do differ (H1 ):


Ri. differ substantial
Ri. not close to R..

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Evaluate the null hypothesis by investigating:


s

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

A few possible configurations:


Method 1
(1,2,3,4)
(1,2,3,5)
(1,2,3,6)
(1,2,3,7)
...
(1,3,5,6)
...

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

Each configuration has a probability of

1
11550

to happen.

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Exact Distribution of K :

PH0 (K 6.16) = 0.0306


Conclusion: Reject H0 : there is a difference between the
farming methods
Large sample size approximation 2 distribution with s 1
d.f.
Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Friedmann Test

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Friedmann Statistic
Setting 1: complete randomization:
Kruskal-Wallis test p-value =0.8611
Treatment effect is blurred by the variability between subjects

Setting 2: randomisation within age groups:


p-value 0.0411
Conclusion reject H0

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Procedure

Divide subjects in homogeneous subgroups (BLOCKS)


Compare subjects within the blocks w.r.t. treatment effects
(Generalisation of the paired comparison design)

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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

Rank subjects within a block:

treatment 20-30 y
A
2
B
1
C
3

Age-group
30-40 y 40-50 y
2
3
1
1
3
2

Doctoral School Medicine

50-60 y
3
2
1

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Mean of ranks for:


treatment A = RA. = 10
4 = 2.5
treatment B = RB. = 64 = 1.5
treatment C = RC . = 94 = 2.25

If these mean ranks are different

reject H0

If these mean ranks are close

accept H0

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Measure for closseness of the mean ranks:


if the Ri. are all close to each other

then they are close to the overall mean R..


and
(Ri. R.. )2 will be close to zero
Friedman Statistic
s

Q=

12N X
(Ri. R.. )2
s(s + 1)
i=1

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

PH0 (Q c) =?

Exact distribution of Q under H0 :


A few possible configurations:
Treatment
A
B
C
A
B
C
A
B
C
...
A
B
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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Number of possibilities for the rank combinations:


age-group 20- 30 year: 3! = 6
age-groups are independent

total number of possible combinations: (3!)4 = 1296

Under the null these are all equally likely :

1
1296

(s!)N , s=] treatment groups, N = ] of blocks


PH0 (Q 3.5) = 0.2731
Do not reject H0

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Sign Test

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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

Doctoral School Medicine

Pain score
After
6
5
7
6
4
3
5
7

Sign
+
+
+
+
+
+
-

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

9 pairs out 15 where treatment comes out ahead (reduction in


pain scores)

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Jonckheere-Terpstra Test

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Parametric Approach : Regression

Models the relationship between a dependent and independent


variable
yi = 0 + 1 xi + i
Assumptions
i N(0, 2 ), i are independent
homoscedasticity
xi is measured without error

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

0 = 169, p-value = < 0.0001


1 = 16, p-value = 0.0133
R-square = 0.3866

Doctoral School Medicine

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

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

Why nonparametric methods What test to use ? Rank Tests

Wilcoxon Rank Sum Test Kruskal-Wallis Test Friedmann Statis

Parametric versus nonparametric tests


Parametric tests:
Assumptions about the distribution in the population
Conditions are often not tested
Test depends on the validity of the assumptions
Most powerful test if all assumptions are met
Nonparametric tests:
Fewer assumptions about the distribution in the population
In case of small sample sizes often the only alternative

(unless the

nature of the population distribution is known exactly)

Less sensitive for measurement error

(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

Anda mungkin juga menyukai