Learn R Programming

decon (version 1.3-4)

bw.dboot1: A bootstrap bandwidth selection without resampling

Description

To compute the optimal bandwidth using the bootstrap-type method without generation of any bootstrap sample.

Usage

bw.dboot1(y,sig, h0="dnrd", error="normal", grid=100, ub=2)

Arguments

y

The observed data. It is a vector of length at least 3.

sig

The standard deviation(s) \(\sigma\). For homoscedastic errors, \(sig\) is a single value. Otherwise, \(sig\) is a vector of variances having the same length as \(y\).

h0

An initial bandwidth parameter. The default vaule is the estimate from bw.dnrd.

error

Error distribution types: 'normal', 'laplacian' for normal and Laplacian errors, respectively.

grid

the grid number to search the optimal bandwidth when a bandwidth selector was specified in bw. Default value "grid=100".

ub

the upper boundary to search the optimal bandwidth, default value is "ub=2".

Value

the selected bandwidth.

Details

Three cases are supported: (1) homo normal; (2) homo laplacian; (3) hetero normal.

Case (3) could be very slow, we reduce the number of grid points in computing the L-2 distance to 100 and reduce the optimal bandwidth searching grid points to 50 to speed up the algorithm.

The integration was approximated by computing the average over a fine grid of points (1000 points).

The case of heteroscedastic laplacian errors is not supported and is to be developed.

References

Delaigle, A. and Gijbels, I. (2004). Practical bandwidth selection in deconvolution kernel density estimation. Computational Statistics and Data Analysis, 45, 249-267.

Wang, X.F. and Wang, B. (2011). Deconvolution estimation in measurement error models: The R package decon. Journal of Statistical Software, 39(10), 1-24.

See Also

bw.dnrd, bw.dmise, bw.dboot2.

Examples

Run this code
# NOT RUN {
n <- 1000
x <- c(rnorm(n/2,-2,1),rnorm(n/2,2,1))
## the case of homoscedastic normal error
sig <- .8
u <- rnorm(n, sd=sig)
w <- x+u
bw.dboot1(w,sig=sig)
## the case of homoscedastic laplacian error
sig <- .8
## generate laplacian errors
u <- ifelse(runif(n) > 0.5, 1, -1) * rexp(n,rate=1/sig)
w <- x+u
bw.dboot1(w,sig=sig,error='laplacian')
## the case of heteroscedastic normal error
sig <- runif(n, .7, .9)
u <- sapply(sig, function(x) rnorm(1, sd=x))
w <- x+u
bw.dboot1(w,sig=sig,error='normal')


# }

Run the code above in your browser using DataLab