bw.dboot2 {decon} | R Documentation |
To compute the optimal bandwidth using the bootstrap method with resampling.
bw.dboot2(y,sig,h0='dboot1',error='normal',B=1000,grid=100,ub=2)
y |
The observed data. It is a vector of length at least 3. |
sig |
The standard deviation(s) σ. 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.dboot1. |
error |
Error distribution types: 'normal', 'laplacian' for normal and Laplacian errors, respectively. |
B |
Bootstrap number, default value 1000. |
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". |
Three cases are supported: (1) homo normal; (2) homo laplacian.
The integration was approximated by computing the average over a fine grid of points (1000 points).
the selected bandwidth.
X.F. Wang wangx6@ccf.org
B. Wang bwang@jaguar1.usouthal.edu
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.
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.dboot2(w,sig=sig) ## the case of homoscedastic laplacian error sig <- .8 ## generate laplacian error u <- ifelse(runif(n) > 0.5, 1, -1) * rexp(n,rate=1/sig) w <- x+u bw.dboot2(w,sig=sig,error='laplacian')