pKW {NSM3}R Documentation

Kruskal-Wallis

Description

Function to compute the P-value for the observed Kruskal-Wallis H statistic.

Usage

pKW(x,g=NA, method=NA, n.mc=10000)

Arguments

x

Either a list or a vector containing the data.

g

If x is a vector, g is a required vector of group labels. Otherwise, not used.

method

Either "Exact", "Monte Carlo", or "Asymptotic", indicating the desired distribution. When method=NA and ties are not present, "Exact" will be used. When method=NA and ties are present, "Exact" will be used if the number of permutations is 10,000 or less. Otherwise, "Monte Carlo" will be used.

n.mc

If method="Monte Carlo", the number of Monte Carlo samples used to estimate the distribution. Otherwise, not used.

Details

The data entry is intended to be flexible, so that the groups of data can be entered in either of two ways. For data a=1,2 and b=3,4,5 the following are equivalent:

pKW(x=list(c(1,2),c(3,4,5))) pKW(x=c(1,2,3,4,5),g=c(1,1,2,2,2))

Value

Returns a list with "NSM3Ch6p" class containing the following components:

n

a vector containing the number of observations in each of the data groups

obs.stat

the observed H statistic

p.val

upper tail P-value

Author(s)

Grant Schneider

See Also

Also see kruskal.test().

Examples

##Hollander-Wolfe-Chicken Example 6.1 Half-Time of Mucociliary Clearance
mucociliary<-list(Normal = c(2.9, 3, 2.5, 2.6, 3.2), Obstructive = c(3.8, 
2.7, 4, 2.4), Asbestosis = c(2.8, 3.4, 3.7, 2.2, 2))

pKW(mucociliary)


[Package NSM3 version 1.18 Index]