h.mlcv: Maximum-Likelihood Cross-Validation for Bandwidth Selection

View source: R/h.mlcv.R

h.mlcvR Documentation

Maximum-Likelihood Cross-Validation for Bandwidth Selection

Description

Computes the maximum-likelihood (Kullback-Leibler) cross-validation bandwidth selector for a kernel density estimator (density estimation only, deriv.order = 0). Returns an S4 object of class bandwidth.

Usage

h.mlcv(x, kernel = "gaussian", lower, upper, tol, nthreads = 0L)

Arguments

x

numeric vector of data values.

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.

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

Habbema, Hermans, and Van den Broek (1974) and Duin (1976) proposed maximising the leave-one-out log-likelihood:

MLCV(h) = n^{-1}\sum_{i=1}^{n} \log\!\left[\hat{f}_{h,i}(X_i)\right]

where the leave-one-out estimator is

\hat{f}_{h,i}(X_i) = \frac{1}{(n-1)h}\sum_{j \neq i}K\!\left(\frac{X_j-X_i}{h}\right)

Equivalently,

h_{mlcv} = \arg\max_{h}\left(n^{-1}\sum_{i}\log\!\left[ \sum_{j \neq i}K\!\left(\frac{X_j-X_i}{h}\right)\right] -\log[(n-1)h]\right)

Only applicable to density estimation (r=0).

Value

An S4 object of class bandwidth with slots:

data

the (cleaned) data vector.

kernel

name of the kernel used.

deriv.order

0L (density only).

h

selected bandwidth.

min.obj

negative of the maximum MLCV value.

hos

over-smoothing bandwidth (upper bound).

method

"MLCV".

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

Duin, R. P. W. (1976). On the choice of smoothing parameters for Parzen estimators of probability density functions. IEEE Transactions on Computers, C-25, 1175–1179.

Habbema, J. D. F., Hermans, J. and Van den Broek, K. (1974). A stepwise discrimination analysis program using density estimation. Compstat 1974: Proceedings in Computational Statistics. Physica Verlag, Vienna.

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

See Also

bandwidth, h.ucv, h.amise, h.scv, dkde.

Examples

x <- rnorm(100)

bw <- h.mlcv(x)
show(bw)
plot(bw)

bw2 <- h.mlcv(x, kernel = "epanechnikov")
show(bw2)
## other kernels on a Marron-Wand sample
h.mlcv(outlier, kernel = "logistic")
h.mlcv(outlier, kernel = "pow(2,2)")

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