cutoff.bootstrap {L2DensityGoFtest} | R Documentation |
Bootstrap critical value for the goodness-of-fit test statistic
of Bagkavos, Patil and Wood (2021)
Description
Implements a bootstrap critical value for testing the goodness-of-fit of a parametrically estimated density with the test statistic S.n
.
Usage
cutoff.bootstrap(xin, M, sim, dist, h.use, kfun, p1, p2, sig.lev)
Arguments
xin |
A vector of data points - the available sample. |
M |
Number of bootstrap replications. |
sim |
A character string indicating the type of simulation required: "ordinary" (the default), "parametric", "balanced", "permutation", or "antithetic". |
dist |
The null distribution. |
h.use |
The test statistic bandwidth, best implemented with |
kfun |
The kernel to use in the density estimates used in the bandwidth expression. |
p1 |
Parameter 1 (vector or object) for the null distribution. |
p2 |
Parameter 2 (vector or object) for the null distribution. |
sig.lev |
Significance level of the hypothesis test. |
Details
Implements the bootstrap based finite sample critical value defined in Section 2.6, Bagkavos, Patil and Wood (2021), and calculated as follows:
1. Resample the observations to obtain
bootstrap samples, denoted by
, where for each
,
is sampled randomly, with replacement, from
. Write
for the estimator of
based on the original sample
and, for each
, define the bootstrap estimator of
by
, where
is the relevant functional for the parameter
.
2. For , use
and
from the previous step to calculate
,
.
3. Calculate as the
empirical quantile of the values
,
. Then
approximately satisfies
, where
indicates the bootstrap probability measure conditional on
.
Value
A scalar, the estimate of the bootstrap critical value at the given significance level.
Author(s)
Dimitrios Bagkavos
R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>
References
Bagkavos, Patil and Wood: Nonparametric goodness-of-fit testing for a continuous multivariate parametric model, (2021), under review.
Gao and Gijbels, Bandwidth selection in nonparametric kernel testing, pp. 1584-1594, JASA (2008)
See Also
cutoff.asymptotic, cutoff.edgeworth
Examples
library(nor1mix)
library(boot)
SampleSize<-80
M<-1000
dist<- "normixt"
kfun<- Epanechnikov
p1 <-MW.nm2
p2 <-1
sig.lev <- 0.05
sim<-"ordinary"
## Not run:
#Run the following to compare the asymptotic and bootstrap cut-off points on 4 occasions:
for(i in 15:18)
{
set.seed(i)
xin<-rnorMix(SampleSize, p1)
h.use <- hopt.be(xin)
l.a.a<-cutoff.asymptotic( dist, p1, p2, sig.lev )
l.a.b<- cutoff.bootstrap(xin, M, sim, dist, h.use, kfun, p1, p2, sig.lev)
#print the result of each iteration:
cat("Asympt. cut.off= ", l.a.a, "Boot. cut.off= ", l.a.b, "\n")
}
## End(Not run)