The NPAR1WAY Procedure

Example 65.3 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 @@;
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

The following statements request a Wilcoxon test of the null hypothesis that there is no difference between the effects of the two stimulants. Stim is the CLASS variable, and Time is the analysis variable. The WILCOXON option requests an analysis of Wilcoxon scores. The CORRECT=NO option removes the continuity correction from the computation of the standardized z test statistic. The WILCOXON option in the EXACT statement requests exact p-values for the Wilcoxon test. Because the sample size is small, the large-sample normal approximation might not be adequate, and it is appropriate to compute the exact test. These statements produce the results shown in Output 65.3.1.

proc npar1way wilcoxon correct=no data=React;
   class Stim;
   var Time;
   exact wilcoxon;

Output 65.3.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 normal approximation for the Wilcoxon two-sample test yields a one-sided p-value of 0.0382 and a two-sided p-value of 0.0764. For the exact Wilcoxon test, the one-sided p-value is 0.0527, and the two-sided p-value is 0.1054.

Output 65.3.1: Wilcoxon Two-Sample Test

The NPAR1WAY Procedure

Wilcoxon Scores (Rank Sums) for Variable Time
Classified by Variable Stim
Stim N Sum of
Under H0
Std Dev
Under H0
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.7720
One-Sided Pr > Z 0.0382
Two-Sided Pr > |Z| 0.0764
t Approximation  
One-Sided Pr > Z 0.0467
Two-Sided Pr > |Z| 0.0933
Exact Test  
One-Sided Pr >= S 0.0527
Two-Sided Pr >= |S - Mean| 0.1054

Kruskal-Wallis Test
Chi-Square 3.1398
DF 1
Pr > Chi-Square 0.0764