bandwidth-class: Class '"bandwidth"' - Result of Bandwidth Selection

bandwidth-classR Documentation

Class "bandwidth" — Result of Bandwidth Selection

Description

An S4 class returned by all bandwidth selector functions in kedd (h.ucv, h.bcv, h.ccv, h.mcv, h.tcv, h.scv, h.amise, h.mlcv). It stores the selected bandwidth together with the data, kernel, derivative order, and optimisation details.

Objects from the Class

Objects are created by calls to the bandwidth selector functions, or directly with new("bandwidth", ...).

Slots

data:

Object of class "numeric". The (cleaned) data vector.

kernel:

Object of class "character". Name of the kernel function used (one of "gaussian", "epanechnikov", "triangular", "biweight", "uniform", "triweight", "tricube", "cosine", "silverman", "logistic" or "pow(s,t)").

deriv.order:

Object of class "integer". Derivative order r \geq 0.

h:

Object of class "numeric". The selected bandwidth.

min.obj:

Object of class "numeric". The minimum value of the cross-validation (or other) criterion at h. NA for h.amise.

hos:

Object of class "numeric". The over-smoothing bandwidth h_{os}; the default search interval is [0.01\,h_{os},\, 2\,h_{os}].

method:

Object of class "character". The selector used: one of "UCV", "BCV1", "BCV2", "CCV", "MCV", "TCV", "SCV", "AMISE", "MLCV".

Methods

show(object)

Prints a compact summary: method, kernel, derivative order, selected bandwidth, minimum criterion.

plot(x, h = NULL, type = "o", n.points = 100L, log_scale_x = FALSE, show.min = TRUE, show.hos = FALSE, ...)

Draws the cross-validation curve over a grid of bandwidths with ggplot2 and marks the selected h. Returns invisibly a list with h, cv and the ggplot object plot. Not available for "AMISE" (closed-form rule, no criterion).

lines(x, n.points = 100L, color, linewidth, linetype, ...)

Returns a ggplot2::geom_line() layer with the curve of x, to be added to a plot: plot(bw1)$plot + lines(bw2).

x$name

Compatibility with kedd 1.x, where the selectors returned a list: bw$h is bw@h, and $ also accepts the slot names, x (the data), n and the 1.x names min.ucv, min.bcv, ... (the slot min.obj). Unknown names give NULL.

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

See Also

h.ucv, h.bcv, h.ccv, h.mcv, h.tcv, h.scv, h.amise, h.mlcv, dkde.

Examples

x <- rnorm(100)
bw <- h.ucv(x, deriv.order = 0)
show(bw)
p <- plot(bw)

## overlay a second criterion (ggplot2 layer)
p$plot + lines(h.bcv(x), color = "darkred")

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