p_wilcox.test {Spower} | R Documentation |
p-value from Wilcox test simulation
Description
Simulates data given one or two parent distributions and returns a p-value. Can also be used for power analyses related to sign tests.
Usage
p_wilcox.test(
n,
d,
n2_n1 = 1,
mu = 0,
type = c("two.sample", "one.sample", "paired"),
exact = NULL,
correct = TRUE,
two.tailed = TRUE,
parent1 = function(n, d) rnorm(n, d, 1),
parent2 = function(n, d) rnorm(n, 0, 1)
)
Arguments
n |
sample size per group |
d |
effect size passed to |
n2_n1 |
sample size ratio |
mu |
parameter used to form the null hypothesis |
type |
type of analysis to use (two-sample, one-sample, or paired) |
exact |
a logical indicating whether an exact p-value should be computed |
correct |
a logical indicating whether to apply continuity correction in the normal approximation for the p-value |
two.tailed |
logical; use two-tailed test? |
parent1 |
data generation function for first group. Ideally
should have SDs = 1 so that |
parent2 |
same as |
Value
a single p-value
Author(s)
Phil Chalmers rphilip.chalmers@gmail.com
Examples
# with normal distributions defaults d is standardized
p_wilcox.test(100, .5)
p_wilcox.test(100, .5, type = 'paired')
p_wilcox.test(100, .5, type = 'one.sample')
# using chi-squared distributions (standardizing to 0-1)
p_wilcox.test(100, .5, type = 'one.sample',
parent1 = function(n, d) rchisq(n, df=10) - 10 + d)
p_wilcox.test(100, .5,
parent1 = function(n, d) (rchisq(n, df=10) - 10)/sqrt(20) + d,
parent2 = function(n, d) (rchisq(n, df=10) - 10)/sqrt(20))
[Package Spower version 0.3.1 Index]