The Wilcoxon Signed Rank Test is the non-parametric version of the paired t-test. It is used to test whether or not there is a significant difference between two population means when the distribution of the differences between the two samples cannot be assumed to be normal.
This tutorial explains how to conduct a Wilcoxon Signed Rank Test in Stata.
How to Perform a Wilcoxon Signed Rank Test in Stata
For this example we will use the fuel dataset, which contains the mpg of 12 cars both before and after they received a certain fuel treatment.
Use the following steps to perform a Wilcoxon Signed Rank Test to determine if there is a difference in the mean mpg between the two groups.
Step 1: Load and view the data.
First, load the dataset by typing the following command into the Command box:
use http://www.stata-press.com/data/r13/fuel
View the raw data by using the following command:
list
The first column, mpg1, shows the mpg of each car before the fuel treatment while the second column, mpg2, shows the mpg of each car after the fuel treatment.
Step 2: Perform the Wilcoxon Signed Rank Test.
We can use the signrank command to perform a Wilcoxon Signed Rank Test in Stata:
signrank mpg1 = mpg2
Here is how to interpret the output:
Summary table:Â The summary table tells us that there were three comparisons for which mpg1 was greater than mpg2, eight comparisons where mpg1 was less than mpg2, and one comparison where the two were equal.
Hypothesis test:Â Near the bottom of the output we can see that the null hypothesis we tested was Ho: mpg1 = mpg2. The z test statistic turned out to be -1.973 and the corresponding p-value was 0.0485. Since this value is less than 0.05, we reject the null hypothesis and conclude that there is a statistically significant difference between the mean mpg of the two groups.
Step 3: Report the results.
Lastly, we want to report the results of the Wilcoxon Signed Rank Test. Here is an example of how to do so:
A Wilcoxon Signed Rank Test was performed to determine if there was a statistically significant difference in the mean mpg before and after a car received fuel treatment. A total of 12 cars were used in the analysis.
Â
The test revealed that there was a statistically significant difference in mean mpg between the two groups (z = -1.973, p = 0.0485).
Â
These results indicate that the fuel treatment had a significant effect on the mpg of a car.