Wilcoxon Signed Rank Test

advertisement
Statistical Methods II
Session 8
Non Parametric Testing –
The Wilcoxon Signed Rank Test
STAT 3130 – Non Parametric Testing
In the previous session, we introduced the concept of NonParametric tests (your Plan B tests). These tests come in
handy when you have small datasets that are not normal.
We reviewed the Sign Test as a simple test of the center
(median) of a variable.
Now we will introduce another non parametric test used to
test the median of a dataset – The Wilcoxon Signed Rank
Test.
STAT 3130 – Non Parametric Testing
Test
Parametric
Non Parametric
One Quantitative
Response Variable
One Sample ttest
Sign Test
One Quantitative
Response Variable – Two
Values from Paired
Samples
Paired Sample ttest
Wilcoxon Signed Rank
Test
One Quantitative
Response Variable – One
Qualitative Independent
Variable with two groups
Two Independent
Sample ttest
Wilcoxon Rank Sum or
Mann Whitney Test
One Quantitative
Response Variable – One
Qualitative Independent
Variable with three or more
groups
ANOVA
Kruskall Wallis
STAT 3130 – Non Parametric Testing
Lets consider the same dataset, and hypotheses from the
previous session and use the Wilcoxon Signed Rank Test:
22, 24, 25, 25, 26, 29, 32, 34, 38, 40, 40, 42, 44
H0: η > 40
H1: η < 40
STAT 3130 – Non Parametric Testing
Step 1: Subtract η0 from each value.
Step 2: Take the absolute value of all the deviations
calculated in Step 1.
Step 3: Delete all of the 0 values and let n be the number of
values which remain.
Step 4: Rank the absolute deviations from the smallest to the
largest. Assign the average of the ranks in cases of ties.
Step 5: Let T+ be the total of ranks given to deviations that
were originally positive.
STAT 3130 – Non Parametric Testing
Step 1: -18, -16, -15, -15, -14, -11, -8, -6, -2, 0, 0, 2, 4
Step 2: 18, 16, 15, 15, 14, 11, 8, 6, 2, 0, 0, 2, 4
Step 3: 18, 16, 15, 15, 14, 11, 8, 6, 2, 2, 4(n=11)
Step 4: 11 (neg), 10 (neg), 8.5 (neg), 8.5 (neg), 7 (neg), 6
(neg), 5 (neg) 4 (neg), 1.5 (neg), 1.5 (pos), 3 (pos)
Step 5: T+ = 1.5 + 3 = 4.5
STAT 3130 – Non Parametric Testing
What is 4.5? This is our test statistic. We can use SAS to
determine the p-value associated with this statistic to
determine if we will reject the null or not.
A note of explanation – If the η is the true median of the
data, then the sum of the ranks for positive deviations will be
about the same as that of the negative deviations.
In this case, the T- would be 61.5 – which is not even close to
4.5. (all of the rankings in aggregate would have been 66,
which is 11+10+9+…1)
STAT 3130 – Non Parametric Testing
The Wilcoxon Signed Rank Test can be used in a Paired
Situation as well . This makes sense, since paired analysis
evaluates a single variable – the difference between the
two samples.
STAT 3130 – Non Parametric Testing
A few notes about when to use the Sign Test and when to
use the Signed Rank Test:
 The Sign Test just considers how many values there are
above or below the hypothesized median. The Wilcoxon
Signed Rank Test is slightly more sophisticated.
 The Wilcoxon Signed Rank Test considers how far the
values actually lie from the hypothesized median – and
could be affected by outliers.
In a paired situation, you should use the Wilcoxon Signed
Rank Test.
STAT 3130 – Non Parametric Testing
Lets go through this analysis using SAS…
Note regarding the SAS output – we will generate a test statistic of
-28.5. How does this square with our value of 4.5? If we subtract
the “shift parameter” – Nt*(Nt+1)/4 , where Nt is the number of obs
NOT EQUAL to the hypothesized median, from the sum of the
positive ranks, we get the S stat as reported in SAS. So the math
here is:
4.5 – ((11*12)/4) = 4.5 – 33 = -28.5
Download