Learn R Programming

uniftest (version 1.1)

sarkadi.unif.test: Sarkadi-Kosik test for uniformity

Description

Performs Sarkadi-Kosik test for the hypothesis of uniformity.

Usage

sarkadi.unif.test(x, nrepl=2000)

Arguments

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

Value

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

Details

The Sarkadi-Kosik test for uniformity is based on the following statistic: $$J = n^2\sum_{i=1}^{n}{\left( \frac{x_i-\frac{i}{n+1}}{i\left(n-i+1\right)} \right)^2}-n\left(\sum_{i=1}^{n}{\frac{x_i-\frac{i}{n+1}}{i\left(n-i+1\right)}} \right)^2.$$ The p-value is computed by Monte Carlo simulation.

References

Kosik P., Sarkadi K. A new goodness-of-fit test // Proc. of 5-th Pannonian Symp. of Math. Stat., Visegrad, Hungary, 20 24 May, 1985. P. 267 272.

Examples

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

Run the code above in your browser using DataLab