kwpower function

Power for the Kruskal-Wallis test.

Power for the Kruskal-Wallis test.

kwpower approximates power 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.

kwpower( nreps, shifts, distname = c("normal", "cauchy", "logistic"), level = 0.05, mc = 0, taylor = FALSE )

Arguments

  • nreps: The numbers in each group.
  • shifts: The offsets for the various populations, under the alternative hypothesis.
  • distname: The distribution of the underlying observations; normal, cauchy, and logistic are currently supported.
  • level: The test level.
  • mc: 0 for asymptotic calculation, or positive for mc approximation.
  • taylor: logical determining whether Taylor series approximation is used for probabilities.

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 power for the Kruskal Wallis test for normal observations, #10 observations in each of three groups, with groups centered at 0, 1, 2. #Level is 0.05 by default. kwpower(rep(10,3),c(0,1,2),"normal")
  • Maintainer: John E. Kolassa
  • License: GPL-2
  • Last published: 2023-08-30

Useful links