kde_gaussian: Multivariate Gaussian KDE with fixed Scott bandwidth

View source: R/kde_gaussian.R

kde_gaussianR Documentation

Multivariate Gaussian KDE with fixed Scott bandwidth

Description

Computes a multivariate Gaussian kernel density estimate at the rows of 'x', using 'data' as the reference sample. Bandwidths are set internally via Scott's rule-of-thumb (diagonal). For 2D, a manually optimized version is used; for higher dimensions, an Eigen-based vectorized version is used.

Usage

kde_gaussian(x, data)

Arguments

x

Numeric matrix 'n_eval x p' (evaluation points).

data

Numeric matrix 'n_data x p' (reference sample for KDE).

Value

Numeric vector of length 'n_eval' with the density estimates.

Examples

x    <- as.matrix(example_env_occ_2d)
data <- as.matrix(example_env_m_2d)
dens <- kde_gaussian(x, data)
head(dens)

xnicher documentation built on Sept. 15, 2026, 5:08 p.m.