sampleSizeWilcoxTwoSample: Sample size for two sample Wilcoxon (Mann-Whitney) test

View source: R/sampleSizeWilcoxTwoSample.R

sampleSizeWilcoxTwoSampleR Documentation

Sample size for two sample Wilcoxon (Mann-Whitney) test

Description

Compute the sample size required to test the hypothesis that two sets of independent samples, X_1, ..., X_m and Y_1, ..., Y_n come from the same population against that Y's is to be larger than X's.

Usage

sampleSizeWilcoxTwoSample(
  delta = 0.75,
  sig.level = 0.05,
  power = 0.9,
  ratio = 0.5,
  two.sided = TRUE
)

Arguments

delta

Probability P(Y_i > X_j).

sig.level

Significance level with default 0.05.

power

Power with default 0.9.

ratio

Ratio of the sample size of group 1 to the total samples size: ratio = m / (m + n), where m and m are the sample sizes of group 1 and 2, respectively. A ratio of 0.5 implies equal group sizes.

two.sided

If TRUE, the test is two-sided. Otherwise, it is one-sided.

Value

data.frame with columns:

delta

delta from input.

sig.level

sig.level from input.

power

power from input.

ratio

ratio from input.

two.sided

two.sided from input.

m

Sample size of the group 1.

n

Sample size of the group 2.

Author(s)

Kaspar Rufibach

References

Nother, G.E. (1987). Sample Size Determination for Some Common Nonparametric Tests JASA, 82, 644–647.

Examples


sampleSizeWilcoxTwoSample(delta = 0.75)
sampleSizeWilcoxTwoSample(delta = 0.85)
sampleSizeWilcoxTwoSample(delta = 0.85, power = 0.8)
sampleSizeWilcoxTwoSample(delta = 0.85, sig.level = 0.01)
sampleSizeWilcoxTwoSample(delta = 0.85, two.sided = FALSE)

tmp <- lapply(X = seq(0.55, 0.95, .1),
              FUN = function(delta) sampleSizeWilcoxTwoSample(delta = delta, ratio = .25))
do.call(what = rbind, args = tmp)


felix-hof/biostatUZH documentation built on Sept. 27, 2024, 1:48 p.m.