Example 47.2: The Exact Wilcoxon Two-Sample Test
Researchers conducted an experiment to compare the effects of two stimulants.
Thirteen randomly selected subjects received the first stimulant and six
randomly selected subjects received the second stimulant. The reaction times
(in minutes) were measured while the subjects were under the influence of the
stimulants.
The following SAS statements create the data set React, which contains the
observed reaction times for each stimulant. The variable Stim represents
Stimulant 1 or 2. The variable Time contains the reaction times observed
for subjects under the stimulant.
data React;
input Stim Time @@;
datalines;
1 1.94 1 1.94 1 2.92 1 2.92 1 2.92 1 2.92 1 3.27
1 3.27 1 3.27 1 3.27 1 3.70 1 3.70 1 3.74
2 3.27 2 3.27 2 3.27 2 3.70 2 3.70 2 3.74
;
PROC NPAR1WAY tests the null hypothesis that there is no
difference between the effects of the two stimulants against an alternative
hypothesis that stimulant 1 has smaller reaction times than stimulant 2.
The WILCOXON option specifies that Wilcoxon scores are to be used. The CLASS
statement specifies that the variable Stim determines the classes.
The VAR statement identifies Time as the response variable. The EXACT option
requests the exact p-values. Since the sample size is small, the normal
approximation may not be completely accurate, and it is appropriate to
compute the exact test.
proc npar1way wilcoxon data=React;
class Stim;
var Time;
exact;
run;
Output 47.2.1: Results of the Wilcoxon Two-Sample Test
Wilcoxon Scores (Rank Sums) for Variable Time Classified by Variable Stim |
Stim |
N |
Sum of Scores |
Expected Under H0 |
Std Dev Under H0 |
Mean Score |
1 |
13 |
110.50 |
130.0 |
11.004784 |
8.500 |
2 |
6 |
79.50 |
60.0 |
11.004784 |
13.250 |
Average scores were used for ties. |
Wilcoxon Two-Sample Test |
Statistic (S) |
79.5000 |
|
|
Normal Approximation |
|
Z |
1.7265 |
One-Sided Pr > Z |
0.0421 |
Two-Sided Pr > |Z| |
0.0843 |
|
|
t Approximation |
|
One-Sided Pr > Z |
0.0507 |
Two-Sided Pr > |Z| |
0.1014 |
|
|
Exact Test |
|
One-Sided Pr >= S |
0.0527 |
Two-Sided Pr >= |S - Mean| |
0.1054 |
Z includes a continuity correction of 0.5. |
Kruskal-Wallis Test |
Chi-Square |
3.1398 |
DF |
1 |
Pr > Chi-Square |
0.0764 |
|
Output 47.2.1 displays the results of the Wilcoxon two-sample test.
The Wilcoxon statistic equals 79.50. Since this value is greater than
60.0, the expected value under the null hypothesis, PROC NPAR1WAY displays
the right-sided p-values. The one-sided exact p-value equals 0.0527,
which is not significant at the 0.05 level. The normal
approximation yields a one-sided p-value of 0.0421, which is significant
at the 0.05 level. Thus, the normal approximation may result in
rejection of the null hypothesis, while the exact test may result
in acceptance.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.