Robust bandwidth estimation for kernel density estimation
Usage
kde_bandwidth(data, multiplier = 1)
Arguments
- data
A numeric matrix or data frame.
- multiplier
Bandwidths are chosen using a robust version of the
normal reference rule multiplied by a constant. The default is 1.
Value
A matrix of bandwidths (or scalar in the case of univariate data).
Examples
# Univariate bandwidth calculation
kde_bandwidth(oldfaithful$duration)
#> [1] 5.01193
# Bivariate bandwidth calculation
kde_bandwidth(oldfaithful[, 2:3])
#> [,1] [,2]
#> [1,] 40.35726 332.8928
#> [2,] 332.89280 21096.1493