bcv_criterion: Cross-validation criteria for quantile density estimators

View source: R/bandwidth.R

bcv_criterionR Documentation

Cross-validation criteria for quantile density estimators

Description

Three data-driven criteria for the smoothing parameter of a quantile density estimator, written as functions of m = 1/h so that they can be passed to [stats::optimize()]. Each is evaluated on the grid u_i = i/n with spacings \Delta_i = X_{(i)} - X_{(i-1)}, X_{(0)} = 0, so that \sum_i \Delta_i\, \phi(\hat q(u_i)) approximates \int \phi\{1/\hat g(x)\}\,dx.

* 'bcv_criterion()' is the biased (least-squares) cross-validation used by Chaubey, Dewan and Li (2024) and Doosti, Dewan and Talebian (2025):

\mathrm{BCV}(h) = \sum_i \Delta_i\, \hat q(u_i;h)^{-2} - \frac{2}{n}\sum_i \hat q_{-i}(u_i;h)^{-1},

i.e. the classical \int \hat g^2 - 2\,\bar{\hat g}_{-i} written in terms of \hat q = 1/\hat g. (Equation (11) of Doosti, Dewan and Talebian (2025) prints \hat q^2 in the first term; the simulation code, reproduced here, uses \hat q^{-2}.) * 'rlcv_criterion()' is the robust likelihood cross-validation of Wu (2019), -\{ \frac1n \sum_i \ln^*(\hat q_{-i}(u_i)^{-1}) - b^*(h) \}, with \ln^* linearised below the threshold a_n. It is written so that it is *minimised*. * 'wbcv_criterion()' is the weighted criterion of Doosti (2026b), which targets u\,q(u) (the quantity entering the first-price auction inversion) rather than q(u):

\mathrm{WBCV}(h) = \sum_i \Delta_i\{u_i \hat q(u_i)\}^2 - \frac{2}{n}\sum_i u_i / \hat q_{-i}(u_i).

**Not recommended; kept only for backward compatibility.** The criterion is not scale-invariant: its two terms have different units (the first scales like the cube of the data units, the second like their inverse), so the selected bandwidth depends on the units of the data; on data of order one or larger the first term dominates and the criterion tends to select the smoothest fit in 'm_range'. The criterion is being revised (Doosti 2026b, revised version); 'wbcv_criterion()' and 'bandwidth = "wbcv"' issue a warning and are kept only so that existing code runs. Use BCV, RLCV or a numeric bandwidth instead.

Usage

bcv_criterion(m, x, fun, loo = TRUE, u_scheme = c("i/n", "i/(n+1)"))

rlcv_criterion(m, x, fun, loo = TRUE, u_scheme = c("i/n", "i/(n+1)"))

wbcv_criterion(m, x, fun, loo = TRUE, u_scheme = c("i/(n+1)", "i/n"))

Arguments

m

inverse bandwidth, m = 1/h.

x

numeric sample (sorted internally).

fun

an estimator with signature 'fun(u, x, h)', e.g. [qdf_kernel()]. Extra arguments (such as 'H' for [qdf_soni()]) should be bound with a closure before calling.

loo

logical; if 'TRUE' (default) leave-one-out fits are computed exactly (by refitting without observation i, or by the index shift of [qdf_bernstein_loo()] for the Bernstein estimator). If 'FALSE' the scaling approximation \hat q_{-i} \approx \hat q\,(n-1)/n is used. The approximation is not valid for estimators built from order statistics: removing X_{(i)} shifts every higher quantile position, and with it least-squares criteria select the roughest fit in 'm_range'. It is kept only for backward compatibility.

u_scheme

grid on which the criterion is evaluated: '"i/n"' (the published convention) or '"i/(n+1)"'.

Value

a single numeric value; smaller is better.

References

Wu, X. (2019). Robust likelihood cross validation for kernel density estimation. *Journal of Business & Economic Statistics*, 37, 761–770.

See Also

[select_bandwidth()], [qdf()]

Examples

x <- rgamma(60, 5, 1)
bcv_criterion(20, x, qdf_kernel)
rlcv_criterion(20, x, qdf_kernel)
optimize(bcv_criterion, c(10, 50), x = x, fun = qdf_bernstein)$minimum

qdfauction documentation built on Nov. 10, 2026, 5:07 p.m.