Tuesday, 22 October 2013

Wilcoxon Signed Rank Test Calculator

The Wilcoxon Signed Rank test is a non-parametric test used to determine whether two dependent/matched groups of data are different. A good example would be the blood sugar level of a group of patients before a particular drug is applied, and the blood sugar level of the same group of patients just after the treatment. The result of Patient 1 before the treatment is matched with the result of Patient 1 after the treatment, and so on.

The Wilcoxon Signed Rank test is robust in that it does not require the data to have a Normal/Gaussian distribution, and can be regarded as the non-parametric counterpart to the parametric Paired Student's t-test. For more details on how to carry out the Wilcoxon Signed Rank test, have a look at the following post, or refer to an appropriate textbook on the subject.

As is common with hypothesis testing in general, we start out with a Null Hypothesis, which can be thought of as our default assumption. The Null Hypothesis for the Wilcoxon Signed Rank test is that the two groups of data are not different. Based on the W statistic, which is calculated from the data, we determine whether to accept or reject the Null Hypothesis. If we have a large enough number of samples (say over 25, to be on the safe side), we can use the calculated p-value to either accept or reject the Null Hypothesis. For a smaller sample size, we read off the critical value of W from a table, and if our calculated W statistic is below the critical W value we reject the Null Hypothesis.

The p-value is the probability of obtaining either the observed difference or a more extreme value of the difference between the two groups, purely based on chance. If the p-value is very low (say below a threshold value of 0.05), we reject the Null Hypothesis and the result is considered significant. On the other hand, if the p-value is greater than 0.05, we accept the Null Hypothesis. One should exercise caution when interpreting the results, but a very low value of the p-value could merit further examination of the data, in terms of investigating the possible causes of the significant difference.

Below is an online calculator of the Wilcoxon Signed Rank test. Please enter Group 1 and Group 2 values as comma separated numbers in the fields below. Group 1 and Group 2 must have the same number of samples, and there must be at least 6 differing samples for each of the two groups for the test results to be valid. Alternatively, you can choose a two-column CSV file to load - simply press on the choose file button below the clear Group 1 and Group 2 buttons. To reload the same file after clearing the text areas, you would need to reload this webpage.

At the bottom there is a graph that will contain histograms of the Group 1 samples and the Group 2 samples, and another graph that will contain the histogram of the differences between the both groups, once the button is pressed to perform the Wilcoxon Signed Rank Test.

Group 1 values:
Group 2 values:

Results pending...

Histograms of the two matched groups

Histogram of the group differences