Title: | Computes Values for the 1-Sample Wilcoxon Sign Rank Test for Medians |
---|---|
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. |
Authors: | Dion Kwan [aut, cre] |
Maintainer: | Dion Kwan <[email protected]> |
License: | GPL-2 |
Version: | 0.0.1 |
Built: | 2025-02-17 04:29:11 UTC |
Source: | https://github.com/dkzk96/wilcoxmed |
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.
W_stat(n , test_stat, side = c('geq','leq','eq'))
W_stat(n , test_stat, side = c('geq','leq','eq'))
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) |
The exact probability values as specified.
W_stat(n=5, test_stat = 3, side = 'leq')
W_stat(n=5, test_stat = 3, side = 'leq')
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, Bickel and Doksum(1973).
Wilcox.m.test(dat, m_h0, alpha = 0.05, alternative=c('greater', 'lesser', 'noteq'), normal_approx=F)
Wilcox.m.test(dat, m_h0, alpha = 0.05, alternative=c('greater', 'lesser', 'noteq'), normal_approx=F)
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 = F) |
This hypothesis test allows breaking of ties, and the number of ties broken is also reflected in the printed results.
Prints out the results of the tests, and returns 3 values- test statistic, p-value, and the significance level of the test, alpha
Wilcox.test() for the same tests applied to 2 sample problems but is not able to break ties
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 = 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)
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 = 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)