bandwidth_rot: MASS' Rule of Thumb Bandwidth Estimation

Description Usage Arguments Value Examples

Description

A well-supported rule-of-thumb for choosing the bandwidth of a Gaussian kernel density estimator.

Usage

1

Arguments

x

Type: numeric vector. A data vector.

Value

A bandwidth on a scale suitable for the width argument of density.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
#?MASS::bandwidth.nrd
bandwidth_rot <- function (x) {
  r <- quantile(x, c(0.25, 0.75))
  h <- (r[2L] - r[1L])/1.34
  4 * 1.06 * min(sqrt(var(x)), h) * length(x)^(-1/5)
}

## End(Not run)

Laurae2/Laurae documentation built on May 8, 2019, 7:59 p.m.