TestUNey: Test of Goodness of Fit (Uniformity)

View source: R/TestUNey.R

TestUNeyR Documentation

Test of Goodness of Fit (Uniformity)

Description

This routine tests whether the values in a vector x is distributed as uniform (0,1). The Neyman's smooth test of fit, as described by Ladwina (1994) is used. The p-values are obtained based on a resampling method from uniform (0,1).

Usage

TestUNey(x, nrep = 10000, sim = NA, n.min = 30)

Arguments

x

A vector of values, each in the interval [0,1].

nrep

The number of replications used to simulate the Neyman distribution.

sim

A vector of simulated values from the Neyman distribution. If sim = NA this vector is generated by the function SimNev, otherwise the vector inputted is used.

n.min

The minimum sample size that triggers the use of asymptotic Chi distribution in place of the emprical distribution in the Neyman test of uniformity.

Value

pn

The p-value for the test.

n4

The value of the test statistics.

Author(s)

Mortaza Jamshidian, Siavash Jalal, and Camden Jansen

References

Ledwina, T. (1994). “Data-driven version of neyman's smooth test of fit,” Journal of the American Statistical Association, 89, 1000-1005, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2290926")}.

Examples

# Example 1
x <- runif(100)
TestUNey(x, nrep = 10000, sim = NA)

# Example 2
x <- runif(30,2,5)
x <- (x-min(x))/(max(x)-min(x))
TestUNey(x, nrep = 10000, sim = NA)

# Example 3
x <- c(0.6,0.6,0.5,0.7,0.3,0.4,0.5,0.4,0.2,0.4,0.2,0.5,0.7,0.1,0.7,0.1,0.5,0.5,0.4,0.6,0.3)
TestUNey(x, nrep = 10000, sim = NA)


MissMech documentation built on May 29, 2024, 11:57 a.m.