cKW: Computes a critical value for the Kruskal-Wallis H...

Description Usage Arguments Value Author(s) Examples

View source: R/cKW.R

Description

This function computes the critical value for the Kruskal-Wallis H distribution at (or typically in the "Exact" and "Monte Carlo" cases, close to) the given alpha level.

Usage

1
cKW(alpha,n, method=NA, n.mc=10000)

Arguments

alpha

A numeric value between 0 and 1.

n

A vector of numeric values indicating the size of each of the k data groups.

method

Either "Exact", "Monte Carlo" or "Asymptotic", indicating the desired distribution. When method=NA, "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.

Value

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

n

number of observations in the k data groups

cutoff.U

upper tail cutoff at or below user-specified alpha

true.alpha.U

true alpha level corresponding to cutoff.U (if method="Exact" or "Monte Carlo")

Author(s)

Grant Schneider

Examples

1
2
3
4
##Hollander-Wolfe-Chicken Example 6.1 Half-Time of Mucociliary Clearance
#cKW(0.0503,c(5,4,5),"Exact")
cKW(0.7147,c(5,4,5),"Asymptotic")
cKW(0.7147,c(5,4,5),"Monte Carlo",n.mc=20000)

Example output

Loading required package: combinat

Attaching package:combinatThe following object is masked frompackage:utils:

    combn

Loading required package: MASS
Loading required package: partitions
Loading required package: survival

Asymptotic Approximation used: 
 
Group sizes: 5 4 5 
For the given alpha=0.7147, the approximate upper cutoff value is Kruskal-Wallis H=0.671784809512408,

Monte Carlo Approximation (with 20000 Iterations) used: 
 
Group sizes: 5 4 5 
For the given alpha=0.7147, the upper cutoff value is Kruskal-Wallis H=0.77142857,
with true alpha level=0.7126

NSM3 documentation built on April 6, 2021, 5:05 p.m.

Related to cKW in NSM3...