Learn R Programming

L2DensityGoFtest (version 0.6.0)

cutoff.bootstrap: Bootstrap critical value for the goodness-of-fit test statistic \(\hat{S}_n(h)\) 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)

Value

A scalar, the estimate of the bootstrap critical value at the given significance level.

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 hopt.be.

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.

Author

Dimitrios Bagkavos

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>

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 \(\mathcal{X}=\{X_1, \dots, X_n\}\) to obtain \(M\) bootstrap samples, denoted by \(\mathcal{X}_m^\ast=\{ X_{1m}^\ast, \dots, X_{nm}^\ast\}\), where for each \(m=1,\ldots , M\), \(\mathcal{X}_m^\ast\) is sampled randomly, with replacement, from \(\mathcal{X}\). Write \(\hat{\theta}=\theta(\mathcal{X})\) for the estimator of \(\theta\) based on the original sample \(\mathcal{X}\) and, for each \(m\), define the bootstrap estimator of \(\theta\) by \(\hat{\theta}_m^\ast = \theta(\mathcal{X}_m^\ast)\), where \(\theta(\cdot)\) is the relevant functional for the parameter \(\theta\).

2. For \(m=1, \ldots , M\), use \(\mathcal{X}_m^\ast =\{X_{1m}^\ast, \dots, X_{nm}^\ast\}\) and \(\hat \theta_m^\ast\) from the previous step to calculate \(n \Delta^{2d} h^{-d/2} \hat S_{n,m}^\ast(h\rho)\),\(m=1, \dots, M\).

3. Calculate \(\ell_\alpha^\ast\) as the \(1-\alpha\) empirical quantile of the values \(n \Delta^{2d} h^{-d/2} \hat S_{n,m}^\ast(h\rho)\), \(m=1, \dots, M\). Then \(\ell_\alpha^\ast\) approximately satisfies \(P^\ast [ n \Delta^{2d} h^{-d/2}\hat S_{n,m}^\ast(h\rho)> \ell_\alpha^\ast ]=1-\alpha\), where \(P^\ast\) indicates the bootstrap probability measure conditional on \(\mathcal{X}\).

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

Run this code
library(nor1mix)
library(boot)
SampleSize<-80
M<-1000
dist<- "normixt"
kfun<- Epanechnikov
p1 <-MW.nm2
p2 <-1
sig.lev <- 0.05

sim<-"ordinary"
if (FALSE) {
#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")
   }
}

Run the code above in your browser using DataLab