kweffectsize: Sample Size for the Kruskal-Wallis test.

View source: R/kweffectsize.R

kweffectsizeR Documentation

Sample Size for the Kruskal-Wallis test.

Description

kweffectsize approximates effect 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.

Usage

kweffectsize(
  totsamp,
  shifts,
  distname = c("normal", "logistic", "cauchy"),
  targetpower = 0.8,
  proportions = rep(1, length(shifts))/length(shifts),
  level = 0.05
)

Arguments

totsamp

sample size

shifts

The offsets for the various populations, under the alternative hypothesis. This is used for direction on input.

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.

Details

The standard noncentral chi-square power formula, or Monte Carlo, is used.

Value

A list with components power, giving the power approximation, ncp, giving the noncentrality parameter, cv, giving the critical value, probs, giving the intermediate output from pairwiseprobability, and expect, the quantities summed before squaring in the noncentrality parameter.

Examples

#Calculate the effecct size necessary to have the desired power .8 for a test
#with the level .5 with sample size 60, group centers 0, 1, and 2, 
#normally distributed observations, evenly split among the three groups.
kweffectsize(60,c(0,1,2),"normal")

MultNonParam documentation built on Aug. 30, 2023, 9:09 a.m.