Skip to contents

kbwrt: Silverman's rule (3.31), \(h = 0.9 \min(s, IQR/1.34) n^{-1/5}\) (the same as stats::bw.nrd0). bwrot: the 1.06 normal-reference rule with the same robust spread (Silverman) or Scott's \(1.059 s n^{-1/5}\). For a non-Gaussian kernel the Gaussian bandwidth is multiplied by the ratio of canonical bandwidths \(\delta_0(K)/\delta_0(\phi)\), \(\delta_0(K) = (R(K)/\mu_2(K)^2)^{1/5}\), so that the two kernels smooth equivalently (2.2138 Epanechnikov, 2.6226 biweight, 2.9780 triweight, 1.7400 uniform). Identical to the Python arms morie.fn.kbwrt and morie.fn.bwrot.

Usage

kbwrt(data, kernel = "gaussian")

bwrot(x, kernel = "gaussian", method = "silverman")

Arguments

data, x

Numeric sample, at least two values.

kernel

One of "gaussian", "epanechnikov", "biweight", "triweight", "uniform".

method

"silverman" or "scott".

Value

A list: bw (kbwrt) or bandwidth (bwrot), the sample standard deviation sigma, the type-7 interquartile range iqr, the sample size and the kernel ratio.

References

Silverman, B. W. (1986). Density Estimation for Statistics and Data Analysis. Chapman and Hall.

Scott, D. W. (1992). Multivariate Density Estimation. Wiley.

Marron, J. S. and Nolan, D. (1988). Canonical kernels for density estimation. Statistics and Probability Letters 7, 195-199.

Examples

kbwrt(c(1, 2, 4, 7, 11))$bw
#> [1] 2.433962
bwrot(c(1, 2, 4, 7, 11), kernel = "epanechnikov")$bandwidth
#> [1] 6.346237