Skip to main content

optim_bandwidth

Function optim_bandwidth 

Source
pub fn optim_bandwidth(
    x: &[f64],
    y: &[f64],
    h_range: Option<(f64, f64)>,
    criterion: CvCriterion,
    kernel: &str,
    n_grid: usize,
) -> OptimBandwidthResult
Expand description

Bandwidth optimizer for kernel smoothers (R’s optim.np).

Grid search over evenly-spaced bandwidths, selecting the one that minimizes the specified criterion (CV or GCV).

§Arguments

  • x — Predictor values
  • y — Response values
  • h_range — Optional (h_min, h_max). Defaults to (h_default / 5, h_default * 5) where h_default = (x_max - x_min) / n^0.2.
  • criterion — CV or GCV
  • kernel — Kernel type
  • n_grid — Number of grid points (default: 50)