h.bcv: Biased Cross-Validation for Bandwidth Selection

View source: R/h.bcv.R

h.bcvR Documentation

Biased Cross-Validation for Bandwidth Selection

Description

Computes the biased cross-validation bandwidth selector (BCV1 or BCV2) of the r'th derivative of a kernel density estimator (one-dimensional). Returns an S4 object of class bandwidth.

Usage

h.bcv(x, whichbcv = 1L, deriv.order = 0L, kernel = "gaussian",
      lower, upper, tol, nthreads = 0L)

Arguments

x

numeric vector of data values.

whichbcv

integer: 1 for BCV1 (Scott and Terrell 1987, default) or 2 for BCV2 (Jones and Kappenman 1991).

deriv.order

non-negative integer: derivative order r. Maximum r for this selector: any for Gaussian and Silverman; cosine 1; logistic 8; Epanechnikov 1; uniform 0; triangular 0; biweight 2; triweight 3; tricube 3; pow(s,t) \min(r^*, 6), where r^* is the largest integer r < t + 1/2 (and r < s + 1/2 if s is not an even integer, and 2r \le st if s and t are integers). Above it h = NA is returned with a warning. See kedd-package, section ‘Maximum derivative order’.

kernel

character string giving the kernel; one of "gaussian" (default), "epanechnikov", "uniform", "triangular", "biweight", "triweight", "tricube", "cosine", "silverman", "logistic", or a power kernel "pow(s,t)" (see kernel.pow).

lower, upper

bounds of the search interval. Defaults to [0.01 * hos, 2 * hos].

tol

convergence tolerance for optimize. Default 0.01 * lower (after validation of lower).

nthreads

number of OpenMP threads for this call: 0 (default) = all processors, k > 0 = k threads, both capped by the environment variable OMP_THREAD_LIMIT. The result does not depend on it, and it never changes the threads used by later calls.

Details

Let

\hat{\theta}_{r}(h)= \frac{(-1)^{r}}{n(n-1)h^{2r+1}} \sum_{i=1}^{n}\sum_{j \neq i} K^{(r)}\ast K^{(r)}\!\left(\frac{X_j-X_i}{h}\right)

and

\bar{\theta}_{r}(h)= \frac{(-1)^r}{n(n-1)h^{2r+1}} \sum_{i=1}^{n}\sum_{j \neq i} K^{(2r)}\!\left(\frac{X_j-X_i}{h}\right)

BCV1 (Scott and Terrell 1987) minimises:

BCV1(h;r)= \frac{R\left(K^{(r)}\right)}{nh^{2r+1}} + \frac{\mu_2^2(K)}{4}\,h^{4}\,\hat{\theta}_{r+2}(h)

BCV2 (Jones and Kappenman 1991) minimises:

BCV2(h;r)= \frac{R\left(K^{(r)}\right)}{nh^{2r+1}} + \frac{\mu_2^2(K)}{4}\,h^{4}\,\bar{\theta}_{r+2}(h)

where K^{(r)}\ast K^{(r)} is the convolution of the r'th kernel derivative (see kernel.conv, kernel.fun), R(K^{(r)})=\int K^{(r)}(x)^2\,dx, \mu_2(K)=\int x^2 K(x)\,dx.

The search is bounded by the over-smoothing bandwidth hos (Terrell and Scott 1985; Scott 1992, p.\,165; Wand and Jones 1995, p.\,61).

Value

An S4 object of class bandwidth with slots:

data

the (cleaned) data vector.

kernel

name of the kernel used.

deriv.order

derivative order r.

h

selected bandwidth.

min.obj

minimum BCV value.

hos

over-smoothing bandwidth (upper bound).

method

"BCV1" or "BCV2".

Author(s)

Arsalane Chouaib Guidoum acguidoum@univ-tam.dz, Amel Henider amel.henider@univ-tam.dz and Iago Giné-Vázquez iago.gin-vaz@protonmail.com

References

Jones, M. C. and Kappenman, R. F. (1991). On a class of kernel density estimate bandwidth selectors. Scandinavian Journal of Statistics, 19, 337–349.

Peter, H. and Marron, J. S. (1987). Estimation of integrated squared density derivatives. Statistics and Probability Letters, 6, 109–115.

Scott, D. W. and Terrell, G. R. (1987). Biased and unbiased cross-validation in density estimation. Journal of the American Statistical Association, 82, 1131–1146.

Wand, M. P. and Jones, M. C. (1995). Kernel Smoothing. Chapman and Hall, London.

Härdle, W. (1991). Smoothing Techniques, With Implementation in S. Springer-Verlag, New York.

See Also

bandwidth, h.ucv, h.ccv, h.mcv, h.tcv, h.scv, h.amise, kernel.conv, kernel.fun, dkde.

Examples

x <- rnorm(100)

## BCV1, density (r = 0)
bw1 <- h.bcv(x, whichbcv = 1, deriv.order = 0)
show(bw1)

## BCV2, first derivative (r = 1)
bw2 <- h.bcv(x, whichbcv = 2, deriv.order = 1)
show(bw2)
plot(bw2)
## other kernels on a Marron-Wand sample
h.bcv(bimodal, kernel = "logistic")
h.bcv(bimodal, whichbcv = 2, kernel = kernel.pow(2, 4))

kedd documentation built on Nov. 12, 2026, 5:10 p.m.