pkolmim: Kolmogorov Dn Distribution

Description Usage Arguments Details Value Source References See Also Examples

Description

Cumulative distribution function for Kolmogorov's goodness-of-fit measure.

Usage

1
pkolmim(d, n)

Arguments

d

the argument for the cumulative distribution function of Dn.

n

the number of variates.

Details

Given an ordered set of n standard uniform variates, x_1 < … < x_n, Kolmogorov suggested D_n = \max[D_n^-, D_n^+] as a goodness-of-fit measure, where: D_n^- = \max_{i=1, … n} [x_i - (i - 1) / n] and D_n^+ = \max_{i=1, … n} [i / n - x_i].

Wang, Tsang, and Marsaglia (2003) have proposed an algorithm to compute the cumulative distribution function K(n, d) = P(D_n < d). pkolmim offers an improved implementation that uses less memory and should be more efficient for a range of arguments that are common in practice, while keeping the same precision.

The original algorithm of Wang, Tsang, and Marsaglia is implemented in the C routine pkolmogorov2x that is used by ks.test (package stats) for one-sample two-sided exact tests. Similarly, pkolmim is used by ks.test.imp in package kolmim.

Value

Returns K(n, d) = P(D_n < d).

Source

The two-sided one-sample distribution comes via Carvalho (2015).

References

Luis Carvalho (2015), An Improved Evaluation of Kolmogorov's Distribution. Journal of Statistical Software, 65/3, 1–7. http://www.jstatsoft.org/v65/c03/.

George Marsaglia, Wai Wan Tsang and Jingbo Wang (2003), Evaluating Kolmogorov's distribution. Journal of Statistical Software, 8/18. http://www.jstatsoft.org/v08/i18/.

See Also

ks.test.imp for a Kolmogorov-Smirnov test similar to ks.test but that uses pkolmim for one-sample two-sided exact tests.

Examples

1
2
3
4
5
6
7
8
n <- 100
x <- 1:100 / 500
plot(x, pkolmim(x, n), type='l')

# Wang et al. approximation
s <- x ^ 2 * n
ps <- pmax(0, 1 - 2 * exp(-(2.000071 + .331 / sqrt(n) + 1.409 / n) * s))
lines(x, ps, lty=2)

Example output



kolmim documentation built on May 2, 2019, 2:26 p.m.

Related to pkolmim in kolmim...