Title: | Computes Values for the 1-Sample Wilcoxon Sign Rank Test for Medians |
Version: | 0.0.1 |
Date: | 2021-01-20 |
Author: | Dion Kwan [aut, cre] |
Maintainer: | Dion Kwan <dkzk96@yahoo.com.sg> |
Description: | An implementation of the 1-Sample Wilcoxon Sign rank test for medians. It includes 2 functions, W_stat(), which computes the exact probabilities of the Wilcoxon Sign Rank Test Statistic, W. The second function, Wilcox.m.test() allows the user to conduct the 1-Sample Wilcoxon Sign Rank hypothesis test for medians, this also allows the user to conduct the hypothesis test for the normal approximation, based on the techniques of Bickel and Doksum (1973, ISBN:013850363X). |
License: | GPL-2 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | no |
Packaged: | 2021-01-22 12:53:38 UTC; Dion |
Repository: | CRAN |
Date/Publication: | 2021-01-25 13:10:02 UTC |
Wilcoxon Sign Rank Test Statistic Exact Distribution
Description
This function allows the user to find the probability values from the exact distribution of W, Bickel and Doksum(1973). The exact P(W=x), P(W<=x), P(W>=x) values is found via an exhaustive enumeration of the possible permutations of data with size n.
Usage
W_stat(n , test_stat, side = c('geq','leq','eq'))
Arguments
n |
Size of data or Number of observations |
test_stat |
The x value specified in P(W=x), P(W<=x), P(W>=x) |
side |
The tails of exact probability the user wants to compute e.g. 'eq' = P(W=x), 'leq' = P(W<=x), 'geq' = 'P(W>=x) |
Value
The exact probability values as specified.
Examples
W_stat(n=5, test_stat = 3, side = 'leq')
1-Sample Wilcoxon Sign Rank Hypothesis Test for Medians
Description
This function allows the user to conduct the 1-Sample Wilcoxon Sign Rank Hypothesis Test for Medians using the probability values from the exact distribution of W.
Usage
Wilcox.m.test(dat, m_h0, alpha = 0.05,
alternative=c('greater', 'lesser', 'noteq'), normal_approx=FALSE)
Arguments
dat |
data vector relating to the sample the user is performing the hypothesis test for |
m_h0 |
The value of the median as specified by the null hypothesis H_0 |
alpha |
The significance level of the hypothesis test (default = 0.05) |
alternative |
The sign of the alternative hypothesis. e.g 'greater' - H_1:m>m_h0 , 'lesser' - H_1:m<m_h0, 'noteq' - H_1:m!=m_h0 |
normal_approx |
Should the normal approximation test be applied? (default = FALSE) |
Details
This hypothesis test allows breaking of ties, and the number of ties broken is also reflected in the printed results.
Value
Prints out the results of the tests, and returns 3 values- test statistic, p-value, and the significance level of the test, alpha
References
Peter J. Bickel and Kjell A. Doksum (1973). Mathematical Statistics: Basic Ideas and Selected Topics. Prentice Hall.
See Also
wilcox.test
for the same tests applied to 2 sample problems
but is not able to break ties
Examples
##Given some data: 3, 4, 7, 10, 4, 12, 1, 9, 2, 15
##If we want to test the hypotheses H_0: m=5 against H_1: m>5
##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 = FALSE)
##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 = TRUE)