SuppDists (version 1.1-9.7)

# KruskalWallis: Kruskall-Wallis distribution

## Description

Density, distribution function, quantile function, random generator and summary function for the Kruskal-Wallis test.

## Usage

dKruskalWallis(x, c, N, U, log=FALSE)
pKruskalWallis(q, c, N, U, lower.tail=TRUE, log.p=FALSE)
qKruskalWallis(p, c, N, U, lower.tail=TRUE, log.p=FALSE)
rKruskalWallis(n, c, N, U)
sKruskalWallis(c, N, U)

## Arguments

x,q

vector of non-negative quantities

p

vector of probabilities

n

number of values to generate. If n is a vector, length(n) values will be generated

c

vector number of treatments

N

vector total number of observations

U

vector sum of reciprocals of the number of the c sample sizes

log, log.p

logical vector; if TRUE, probabilities p are given as log(p)

lower.tail

logical vector; if TRUE (default), probabilities are $$P[X <= x]$$, otherwise, $$P[X > x]$$

## Value

The output values conform to the output from other such functions in R. dKruskalWallis() gives the density, pKruskalWallis() the distribution function and qKruskalWallis() its inverse. rKruskalWallis() generates random numbers. sKruskalWallis() produces a list containing parameters corresponding to the arguments -- mean, median, mode, variance, sd, third cental moment, fourth central moment, Pearson's skewness, skewness, and kurtosis.

## Details

This is a one-way layout with, perhaps, unequal sample sizes for each treatment. There are c treatments with sample sizes $$n_j, j=1 \dots c$$. The total sample size is $$N=\sum_1^c n_j$$. The distribution depends on c, N, and U, where $$U=\sum_1^c (1/n_j)$$.

Let $$R_j$$ be the sum of the ranks for treatment $$j (j=1\dots c)$$ then the Kruskal-Wallis statistic is

$$x=\frac{12}{N(N+1)}\sum_{j=1}^{c}\frac{R_j^2}{n_j} - 3(N+1)$$

This is asymptotically equivalent to a chi-squared variable with c-1 degrees of freedom.

The original paper is Kruskal and Wallis (1952) with errata appearing in Kruskal and Wallis (1953). No attempt is made to calculate exact values, rather an incomplete beta approximation is used following Wallace (1959).

## References

Kruskal, W.H. and Wallis, W.A. (1952) Use of ranks in one-criterion variance analysis. Jour. Am. Stat. Assoc. 47. 583-634

Kruskal, W.H. and Wallis, W.A. (1953) Errata to Use of ranks in one-criterion variance analysis. Jour. Am. Stat. Assoc. 48. 907-911.

Wallace, D.L. (1959). Simplified beta-approximations to the Kruskal-Wallis H test. Jour. Am. Stat. Assoc. 54. 225-230.

## Examples

Run this code
# NOT RUN {
# Assuming three treatments, each with a sample size of 5.
pKruskalWallis(1, 3, 15, 0.6)
pKruskalWallis(c(.1,1.5,5.7), 3, 15, 0.6) ## approximately 5% 50% and 95%
sKruskalWallis(3, 15, 0.6)
plot(function(x)dKruskalWallis(x, 3, 15, 0.6),0.5,8)

# }


Run the code above in your browser using DataCamp Workspace