KW {CMHNPA}R Documentation

KW

Description

KW returns the test statistic and p-value for the Kruskal-Wallis test adjusted for ties.

Usage

KW(
  treatment,
  response,
  n_components = 0,
  n_permutations = 0,
  treatment_scores = NULL,
  sig_digits = 4,
  verbose = FALSE
)

Arguments

treatment

a factor that defines the group the response belongs to.

response

a numeric variable measuring the response outcome.

n_components

the number of polynomial components you wish to test. The maximum number of components is the number of treatments less one. If the number of components requested is less than t-2, a remainder component is created.

n_permutations

the number of permutations you wish to run.

treatment_scores

the scores to be applied to the treatment groups. If not declared these will be set automatically and should be checked.

sig_digits

the number of significant digits the output should show.

verbose

flag for turning on the status bar for permutation tests.

Details

The Kruskal-Wallis test is a non-parametric equivalent to the one way ANOVA.

Value

The function returns the test result of the Kruskal Wallis test with adjustment for ties and without.

References

Rayner, J.C.W and Livingston Jr, G. C. (2022). An Introduction to Cochran-Mantel-Haenszel Testing and Nonparametric ANOVA. Wiley.

Examples

attach(whiskey)
KW(treatment = maturity, response = grade)

[Package CMHNPA version 1.1.1 Index]