bandwidths: Bandwidth Selectors

Description Arguments Details Bandwidth selectors Structure References See Also Examples

Description

The available options for bandwidth selectors, passed as the bw argument to kdensity.

Arguments

x

The input data.

kernel_str

A string specifying the kernel, e.g. "gaussian."

start_str

A string specifying the parametric start, e.g. "normal".

support

The domain of definition for the kernel. (-Inf, Inf) for symmetric kernels.

Details

The bandwidth functions are not exported. They are members of the environment bw_environments, and can be accessed by kdensity:::bw_environments.

Bandwidth selectors

"nrd0", "nrd", "bcv", "SJ": Bandwidth selectors from stats. They are documented in [bandwidth][stats::bandwidth] stats:bandwidth. "nrd0" is the standard bandwidth selector for symmetric kernels with constant parametric starts.

"ucv": Unbiased cross validation. The standard option for asymmetric kernels.

"RHE": Selector for parametric starts with a symmetric kernel, based on a reference rule with Hermite polynomials. Described in Hjort & Glad (1995). The default method in kdensity when a parametric start is supplied and the kernel is symmetric.

"JH": Selector for the Gaussian copula kernel, based on normal reference rule. Described in Jones & Henderson. The default method when the gcopula kernel is used in kdensity.

Structure

The bandwidth selector is a function of four arguments: The data x, a kernel string kernel, a start string start, and a support vector support. To obtain the functions associated with these strings, use get_kernel and get_start. The function should return a double.

References

Jones, M. C., and D. A. Henderson. "Kernel-type density estimation on the unit interval." Biometrika 94.4 (2007): 977-984. Hjort, Nils Lid, and Ingrid K. Glad. "Nonparametric density estimation with a parametric start." The Annals of Statistics (1995): 882-904.

See Also

kdensity(), stats::bandwidth.kernel() for the bandwidth selectors of stats::density(). In addition, kernels(); parametric_starts()

Examples

1
2
3
4
5
   ## Not a serious bandwidth function.
   silly_width = function(x, kernel = NULL, start = NULL, support = NULL) {
     rexp(1)
   }
   kdensity(mtcars$mpg, start = "gumbel", bw = silly_width)

Example output

Call:
kdensity(x = mtcars$mpg, bw = silly_width, start = "gumbel")

Data:      mtcars$mpg (32 obs.)
Bandwidth: 5.655 ('silly_width')
Support:   (-Inf, Inf)
Kernel:    gaussian
Start:     gumbel

kdensity documentation built on Oct. 23, 2020, 8:32 p.m.