Learn R Programming

uniftest (version 1.1)

kolmogorov.unif.test: Kolmogorov-Smirnov test for uniformity

Description

Performs Kolmogorov-Smirnov test for the hypothesis of uniformity, see Kolmogorov (1933).

Usage

kolmogorov.unif.test(x, nrepl=2000,k=0)

Arguments

x
a numeric vector of data values.
nrepl
the number of replications in Monte Carlo simulation.
k
variant the criterion.

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the Kolmogorov-Smirnov statistic.
  • p.valuethe p-value for the test.
  • methodthe character string "Kolmogorov-Smirnov test for uniformity".
  • data.namea character string giving the name(s) of the data.

Details

The Kolmogorov-Smirnov test for uniformity is based on the following statistics: $$D^+ = max_i\left(x_i-\frac{i}{n+1}\right),\quad D^- = max_i\left(\frac{i}{n+1}-x_i\right),\quad D = max(D^+,D^-).$$ The p-value is computed by Monte Carlo simulation.

References

Kolmogorov A. (1933): Sulla determinazione empirica di una legge di distribuzione. --- G. Ist. Ital. Attuari, vol. 4, pp. 83--91.

Examples

Run this code
kolmogorov.unif.test(runif(100,0,1))
kolmogorov.unif.test(runif(100,0.1,0.9))

Run the code above in your browser using DataLab