h.scv: Smoothed Cross-Validation for Bandwidth Selection

View source: R/h.scv.R

h.scvR Documentation

Smoothed Cross-Validation for Bandwidth Selection

Description

Selects the bandwidth of the r'th derivative kernel density estimator by minimising the smoothed cross-validation (SCV) criterion of Hall, Marron and Park (1992). Returns an S4 object of class bandwidth.

Usage

h.scv(x, g = NULL, deriv.order = 0L, kernel = "gaussian",
      lower, upper, tol, nthreads = 0L)

Arguments

x

numeric vector of data values.

g

pilot bandwidth (positive number). If NULL (default), g = \hat{\sigma}\,0.9266\,n^{-2/13} (Hall et al. 1992, eq. 4.2).

deriv.order

non-negative integer: derivative order r; no upper limit (Gaussian kernel). See kedd-package, section ‘Maximum derivative order’.

kernel

must be "gaussian", the only kernel for which the SCV criterion is available in closed form.

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

With a Gaussian kernel and a Gaussian pilot estimate \tilde f_g, the integrated squared bias of \hat f_h^{(r)} is estimated in closed form by derivatives of normal densities:

SCV(h; r) = \frac{R(K^{(r)})}{n h^{2r+1}} + \frac{(-1)^r\,2}{n(n-1)} \sum_{i<j} \left[\phi^{(2r)}_{s_1} - 2\phi^{(2r)}_{s_2} + \phi^{(2r)}_{s_3}\right](X_j - X_i),

where s_1 = \sqrt{2(h^2+g^2)}, s_2 = \sqrt{h^2+2g^2}, s_3 = \sqrt{2}\,g and \phi^{(k)}_s(u) = \phi^{(k)}(u/s)/s^{k+1}. It follows from \int [((K_h-\delta) * \tilde f_g)^{(r)}]^2 = (-1)^r \int ((K_h-\delta) * \tilde f_g)\,((K_h-\delta) * \tilde f_g)^{(2r)}. For r = 0 it is the criterion of Hall, Marron and Park (1992).

The default pilot bandwidth is the density pilot of Hall et al.; for derivatives a pilot can be supplied through g.

Value

An S4 object of class bandwidth with method = "SCV".

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

Hall, P., Marron, J. S. and Park, B. U. (1992). Smoothed cross-validation. Probability Theory and Related Fields, 92, 1–20.

See Also

h.ucv, h.bcv, bandwidth.

Examples

x <- rnorm(200)
bw <- h.scv(x)
show(bw)
plot(bw)

## first derivative (r = 1)
bw1 <- h.scv(x, deriv.order = 1)
plot(dkde(data = x, h = bw1@h, deriv.order = 1))
## on a Marron-Wand sample (SCV is defined for the Gaussian kernel)
h.scv(bimodal)
h.scv(bimodal, deriv.order = 2)

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