kwsamplesize approximates sample size for the Kruskal-Wallis test, using a chi-square approximation under the null, and a non-central chi-square approximation under the alternative. The noncentrality parameter is calculated using alternative means and the null variance structure.
shifts: The offsets for the various populations, under the alternative hypothesis.
distname: The distribution of the underlying observations; normal and logistic are currently supported.
targetpower: The distribution of the underlying observations; normal and logistic are currently supported.
proportions: The proportions in each group.
level: The test level.
taylor: Logical flag forcing the approximation of exceedence probabilities using the first derivative at zero.
Returns
A list with the total number of observations needed to obtain approximate power, as long as this number is split amomg groups according to argument proportion.
Details
The standard noncentral chi-square power formula, is used.
Examples
#Calculate the sample size necessary to detect differences among three#groups with centers at 0,1,2, from normal observations, using a test of#level 0.05 and power 0.80.kwsamplesize(c(0,1,2),"normal")