View source: R/bw.f.BGM.boot2.R
| bw.f.BGM.boot2 | R Documentation |
This function computes the bandwidth selector for \insertCitejones1991;textualWData kernel density estimator using the bias-corrected bootstrap method developed by \insertCiteborrajo2017;textualWData.
bw.f.BGM.boot2(
y,
w = function(y) {
ifelse(y >= 0, y, NA)
},
kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight",
"cosine", "optcosine"),
bw0 = 1/8 * n^(-1/9),
lower = IQR(y) * n^(-0.2) * 2000^(-1),
upper = IQR(y) * (log(n)/n)^(0.2) * 500,
nh = 200L,
tol = 0.1 * lower,
from = min(y) - (sort(y)[5] - min(y)),
to = max(y) + (max(y) - sort(y, decreasing = TRUE)[5]),
plot = TRUE
)
y |
A numeric vector containing the biased sample. |
w |
A function representing the bias function applied to the data points. It must be evaluable and positive in each point of the sample |
kernel |
A character string specifying the kernel function. Available options: |
bw0 |
The bandwidth value to be used in |
lower |
Numeric value specifying the lower bound for bandwidth selection. Default is computed based on the interquartile range (IQR) and sample size. |
upper |
Numeric value specifying the upper bound for bandwidth selection. Default is computed based on the interquartile range (IQR) and sample size. |
nh |
An integer specifying the number of points in the grid to evaluate the mean integrated squared error function. Default is 200. |
tol |
Tolerance value used to check whether the minimum found lies at the boundaries of the interval; that is, the function will return a warning if the window minimizing the cross-validation function lies within |
from |
Numeric value specifying the lower bound to be used in |
to |
Numeric value specifying the upper bound to be used in |
plot |
Logical value indicating whether to plot the mean integrated squared error function. Default is |
The bandwidth returned is the one minimizing \mathrm{MISE}^{\ast} over a compact interval [h_1,h_2] (determined by arguments lower and upper), i.e.,
\widehat{h}_{f, \mathrm{B}} = \arg \min_{h_{f} \in [h_1,h_2]} \int_{-\infty}^{+ \infty} \mathrm{MSE}^{\ast}\left(\widehat{f}^{\ast}_{\mathrm{J}, h_{f}}(y)\right)dy.
\mathrm{MISE}^{\ast} and \mathrm{MSE}^{\ast} correspond with the expression of the mean integrated squared error and the mean squared error of the bootstrap estimator \widehat{f}^{\ast}_{\mathrm{J}, h_{f}} provided by \insertCiteborrajo2017;textualWData.
The bootstrap bandwidth value.
df.jones
bw.f.BGM.boot2(shrub.data$Width, nh = 50L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.