Learn R Programming

NSM3 (version 1.18)

cKolSmirn: Computes a critical value for the Kolmogorov-Smirnov J distribution.

Description

This function uses pSmirnov2x from the base stats package to compute the critical value for the Kolmogorov-Smirnov J distribution at (or typically in the "Exact" case, close to) the given alpha level. The program is reasonably quick for large data, well after the asymptotic approximation suffices, so Monte Carlo methods are not included.

Usage

cKolSmirn(alpha, m, n, method=NA, n.mc=10000)

Value

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

m

number of observations in the first data group (X)

n

number of observations in the second data group (Y)

cutoff.U

upper tail cutoff at or below user-specified alpha

true.alpha.U

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

Arguments

alpha

A numeric value between 0 and 1.

m

A numeric value indicating the size of the first data group (X).

n

A numeric value indicating the size of the second data group (Y).

method

Either "Exact" or "Asymptotic", indicating the desired distribution. When method=NA, if m+n<=200, the "Exact" method will be used to compute the J distribution. Otherwise, the "Asymptotic" method will be used.

n.mc

Not used. Only included for standardization with other critical value procedures in the NSM3 package.

Author

Grant Schneider

References

This function uses the source code ks.c from the stats package by: R Core Team (2013). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL http://www.R-project.org/.

See Also

Also see ks.test().

Examples

Run this code
##Hollander-Wolfe-Chicken Example 5.4 Effect of Feedback on Salivation Rate:
cKolSmirn(0.0524,10,10,"Exact")

##or
cKolSmirn(0.06,10,10,"Exact")

##LSA
cKolSmirn(0.0551,10,10,"Asymptotic")

Run the code above in your browser using DataLab