kweffectsize function

Sample Size for the Kruskal-Wallis test.

Sample Size for the Kruskal-Wallis test.

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.

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.

Returns

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.

Details

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

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")
  • Maintainer: John E. Kolassa
  • License: GPL-2
  • Last published: 2023-08-30

Useful links