rankEnv.test: Envelope test of goodness of fit

Description Usage Arguments Details Author(s) References Examples

View source: R/envelopetest.R

Description

Test if an observed curve matches a sample of simulated curves (or a group of other observations). A global envelope test is performed, with p-value corresponding to the most extreme pointwise percentile the observed curve reaches among all curves.

Usage

1
2
rankEnv.test(obs, sim, alternative = c("two.sided", "less", "greater"),
  inclprob = 0.95, includeobs = TRUE)

Arguments

obs

object of class fdsample, the observed curve.

sim

object of class fdsample, the group of curves to which obs is compared.

alternative

a character string specifying the alternative hypothesis, one of "two.sided" (default), "less" or "greater". May be abbreviated.

inclprob

a numerical vector of inclusion probabilities of the envelopes to be plotted, for use in plot.envtest

includeobs

logical, if TRUE, observed curve is also used in the envelope

Details

The observed curve, represented by the fdsample object obs is compared to simulated curves collected in the fdsample object 'sim. The two sets of curves have to share the same argument values, and obs is supposed to contain only one curve.

alternative == "less" is the one-sided alternative meaning that the observed curve has (some) smaller function values than the simulated curves, and alternative == "greater" is the opposite one-sided alternative.

The test corresponds to the rank envelope test by Myllymaki et. al (2013, 2015), and to the procedure described in Davison and Hinkley (1997), Equation (4.17). The p-value is obtained by ranking the curves according to the minimum pointwise rank obtained in any point of the curve – note that the curves are actually represented as vectors.

The result of the test can be plotted, see plot.envtest.

Author(s)

Ute Hahn, ute@imf.au.dk

References

M. Myllymaki, T. Mrkvicka, H. Seijo and P. Grabarnik (2013) Global envelope tests for spatial processes, http://arxiv.org/abs/1307.0239v2.

M. Myllymaki, T. Mrkvicka, P. Grabarnik, H. Seijo and Ute Hahn (2015) Global envelope tests for spatial processes, http://arxiv.org/abs/1307.0239v3.

Davison, A.C. and Hinkley, D.V. (1997) Bootstrap Methods and their Applications, Cambridge University Press, Cambridge.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# make a sample of sinus curves
tt <- seq(0, 2*pi, length = 20)
sinsim <- replicate(5000, sin(tt) + cumsum(rnorm(20, 0, 0.01)))
sinobs <- sin(tt - pi/50) + cumsum(rnorm(20, 0, 0.01))
sim <- fdsample(tt, sinsim)
obs <- fdsample(tt, sinobs)

testresult <- rankEnv.test(obs, sim)
print(testresult)
plot(testresult)

fdnonpar documentation built on May 2, 2019, 5:54 p.m.