The R package implementation of the 1-Sample Wilcoxon Signed Rank Hypothesis Test for medians - allows breaking of ties, computation of the Wilcoxon Test Statistic with normal approximations.
We refer to the Wilcoxon Sign Ranked hypothesis test for medians for the one-sample problem.
Given that .
Assume that
is unknown except that it is continuous and symmetric.
We wish to test
against
at the significance level
Let .
The test statistic is
,
or equivalently
We reject iff
For this problem, there could be ties in the data, however the algorithm is able to break the ties by assigning the average absolute rank to each tied value.
The exact distribution of is taken from Bickel and Doksum (1973).
The normal approximations to can be found via the following theorem:
Theorem: If ,
is continuous,
then as
, we have:
Given some data:
If we want to test the hypotheses against
without using normal approximation:
vec = c(3, 4, 7, 10, 4, 12, 1, 9, 2, 15)
res = Wilcox.m.test(dat = vec, m_h0 = 5, alternative = 'greater', normal_approx = F)
If we want to apply the normal approximation(Z-test), with the same hypotheses:
res = Wilcox.m.test(dat = vec, m_h0 = 5, alternative = 'greater', normal_approx = T)
To find for
:
W_stat(n=5, test_stat = 3, side = 'leq')