Learn R Programming

ddst (version 1.4)

ddst.uniform.test: Data Driven Smooth Test for Uniformity

Description

Performs data driven smooth tests for simple hypothesis of uniformity on [0,1].

Usage

ddst.uniform.test(x, base = ddst.base.legendre, c = 2.4, B = 1000, compute.p = F, Dmax = 10, ...)

Arguments

x
a (non-empty) numeric vector of data values.
base
a function which returns orthogonal system, might be ddst.base.legendre for Legendre polynomials or ddst.base.cos for cosine system, see package description.
c
a parameter for model selection rule, see package description.
B
an integer specifying the number of replicates used in p-value computation.
compute.p
a logical value indicating whether to compute a p-value.
Dmax
an integer specifying the maximum number of coordinates, only for advanced users.
...
further arguments.

Value

An object of class htest
statistic
the value of the test statistic.
parameter
the number of choosen coordinates (k).
method
a character string indicating the parameters of performed test.
data.name
a character string giving the name(s) of the data.
p.value
the p-value for the test, computed only if compute.p=T.

Details

Embeding null model into the original exponential family introduced by Neyman (1937) leads to the information matrix I being identity and smooth test statistic with k components $W_k=[1/sqrt(n) sum_j=1^k sum_i=1^n phi_j(Z_i)]^2$, where $phi_j$ is jth degree normalized Legendre polynomial on [0,1] (default value of parameter base = `ddst.base.legendre'). Alternatively, in our implementation, cosine system can be selected (base = `ddst.base.cos'). For details see Ledwina (1994) and Inglot and Ledwina (2006).

An application of the pertaining selection rule T for choosing k gives related `ddst.uniform.test()' based on statistic $W_T$.

Similar approach applies to testing goodness-of-fit to any fully specified continuous distribution function F. For this purpose it is enough to apply the above solution to transformed observations $F(z_1),...,F(z_n)$.

For more details see: http://www.biecek.pl/R/ddst/description.pdf.

References

Inglot, T., Ledwina, T. (2006). Towards data driven selection of a penalty function for data driven Neyman tests. Linear Algebra and its Appl. 417, 579--590.

Ledwina, T. (1994). Data driven version of Neyman's smooth test of fit. J. Amer. Statist. Assoc. 89 1000-1005.

Neyman, J. (1937). `Smooth test' for goodness of fit. Skand. Aktuarietidskr. 20, 149-199.

Examples

Run this code

# H0 is true
z = runif(80)
ddst.uniform.test(z, compute.p=TRUE)

# known fixed alternative
z = rnorm(80,10,16)
ddst.uniform.test(pnorm(z, 10, 16), compute.p=TRUE)


# H0 is false
z = rbeta(80,4,2)
(t = ddst.uniform.test(z, compute.p=TRUE))
t$p.value

Run the code above in your browser using DataLab