WOLFRAM NOTEBOOK

WOLFRAM|DEMONSTRATIONS PROJECT

A Signed Rank Test of Hypotheses about a Median

sample size
4
population mean
0
test type:
H
a
: m
m
0
H
0
: m =
m
0
H
a
: m
m
0
H
0
: m =
m
0
H
a
: m
m
0
H
0
: m =
m
0
m
0
to test against
0
new sample
The statistic
W
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
X
i
-
m
0
multiplied by the sign of
X
i
-
m
0
(so values below
m
0
get assigned a negative rank). These signed ranks are then summed to produce
W
. If the null hypothesis is true, that is, if
m
0
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
n(n+1)(2n+1)/6
. 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.
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
(i,
X
i
)
with a horizontal line at the point
m
0
. 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
m
0
.
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.