sim.power.wilcox.test {MKpower}R Documentation

Monte Carlo Simulations for Empirical Power of Wilcoxon-Mann-Whitney Tests

Description

Simulate the empirical power and type-I-error of Wilcoxon-Mann-Whitney tests.

Usage

sim.power.wilcox.test(nx, rx, rx.H0 = NULL, ny, ry, ry.H0 = NULL, 
                      alternative = c("two.sided", "less", "greater"), 
                      sig.level = 0.05, conf.int = FALSE, approximate = FALSE,
                      ties = FALSE, iter = 10000, nresample = 10000,
                      parallel = "no", ncpus = 1L, cl = NULL)

Arguments

nx

single numeric, sample size of first group.

rx

function to simulate the values of first group (assuming H1).

rx.H0

NULL or function to simulate the values of first group (assuming H0).

ny

single numeric, sample size of second group.

ry

function to simulate the values of second group (assuming H1).

ry.H0

NULL or function to simulate the values of second group (assuming H0).

alternative

one- or two-sided test. Can be abbreviated.

sig.level

significance level (type I error probability)

conf.int

logical, shall confidence intervals be computed. Strongly increases computation time!

approximate

logical, shall an approximate test be computed; see LocationTests. Increases computation time!

ties

logical, indicating whether ties may occur. Increases computation time!

iter

single positive integer, number of interations of the simulations.

nresample

single positive integer, the number of Monte Carlo replicates used for the computation of the approximative reference distribution; see NullDistribution.

parallel

a character, the type of parallel operation: either "no" (default), "multicore" or "snow"; see NullDistribution.

ncpus

a single integer, the number of processes to be used in parallel operation. Defaults to 1L; see NullDistribution.

cl

an object inheriting from class "cluster", specifying an optional parallel or snow cluster if parallel = "snow". Defaults to NULL; see NullDistribution.

Details

Functions rx and ry are used to simulate the data under the alternative hypothesis H1. If specified, functions rx.H0 and ry.H0 simulte the data unter the null hypothesis H0.

For fast computations functions from package matrixTests and package coin are used.

Value

Object of class "sim.power.wtest" with the results of the Wilcoxon-Mann-Whitney tests. A list elements Exact, Asymptotic and Approximate. In addition, the simulation setup is saved in element SetUp.

Author(s)

Matthias Kohl Matthias.Kohl@stamats.de

References

Mann, H and Withney, D (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of mathematical Statistics, 18, 50-60.

Wilcoxon, F (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin, 1, 80-83.

See Also

wilcox.test, LocationTests, wilcoxon

Examples

## Equal variance, small sample size
power.t.test(n = 5, power = 0.8)
sim.ssize.wilcox.test(rx = rnorm, ry = function(x) rnorm(x, mean = 2), 
                      power = 0.8, n.min = 3, n.max = 10, step.size = 1)
sim.power.wilcox.test(nx = 6, rx = rnorm, rx.H0 = rnorm,
                      ny = 6, ry = function(x) rnorm(x, mean = 2), 
                      ry.H0 = rnorm)

[Package MKpower version 0.9 Index]