A Signed Rank Test of Hypotheses about a Median
A Signed Rank Test of Hypotheses about a Median
The statistic on which this test is based is computed by assigning to each value in the dataset its ranking in the list of the absolute differences multiplied by the sign of  (so values below get assigned a negative rank). These signed ranks are then summed to produce . If the null hypothesis is true, that is, if is the median of the distribution from which the sample comes, then the signs of the differences can be regarded as Bernoulli trials. Using this to assign probabilities to all the possible signed rank sums gives the distribution which is shown in blue in the upper image above. The mean of this distribution is zero and its variance is . The purple curve is the density of a normal distribution with this mean and variance, which gives a good approximation to this distribution for all but very small sample sizes.
W

X
i
m
0
X
i
m
0
m
0
W
m
0
n(n+1)(2n+1)/6
You can control the mean of the underlying population and the size of this sample with the top two sliders, and you can draw new samples of the same size from the same underlying population with the bottom slider.
The lower image shows the scatterplot of the points with a horizontal line at the point . The degree to which the points in the plot are above or below this line is evidence for the median of the underlying distribution being above or below .
(i,)
X
i
m
0
m
0