ks.test.imp: Kolmogorov-Smirnov Tests

Description Usage Arguments Details Value Source References See Also Examples

Description

Perform a one-sample two-sided exact Kolmogorov-Smirnov test, similarly to ks.test from package stats, but using an improved routine.

Usage

1

Arguments

x

a numeric vector of data values.

y

either a numeric vector of data values, or a character string naming a cumulative distribution function or an actual cumulative distribution function such as pnorm. Only continuous CDFs are valid.

...

parameters of the distribution specified (as a character string) by y.

Details

This routine is equivalent to ks.test(x, y, ..., exact=TRUE) but uses an improved method based on pkolmim. For more details about the arguments, please refer to the documentation for ks.test.

Value

A list with class "htest" containing the following components:

statistic

the value of the test statistic.

p.value

the p-value of the test.

alternative

"two-sided".

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

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/.

See Also

pkolmim for the cumulative distribution function of Kolmogorov's goodness-of-fit measure.

Examples

1
2
3
4
5
6
7
8
9
x <- abs(rnorm(100))
p.kt <- ks.test(x, "pexp", exact = TRUE)$p
p.ktimp <- ks.test.imp(x, "pexp")$p
abs(p.kt - p.ktimp)

# compare execution times
x <- abs(rnorm(2000))
system.time(ks.test.imp(x, "pexp"))
system.time(ks.test(x, "pexp", exact = TRUE))

Example output

[1] 5.551115e-16
   user  system elapsed 
  0.393   0.000   0.394 
   user  system elapsed 
  1.475   0.001   1.475 

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

Related to ks.test.imp in kolmim...