Learn R Programming

gplm (version 0.7-4)

bandwidth.scott: Scott's rule of thumb

Description

Calculates Scott's rule of thumb bandwidth vector.

Usage

bandwidth.scott(x, kernel = "biweight", product = TRUE)

Arguments

x
n x d matrix, data
kernel
text string, see kernel.function
product
(if d>1) product or spherical kernel

Value

d x 1 bandwidth vector used for calculation

Details

The default bandwidth vector is computed by Scott's rule of thumb for the Gaussian kernel and adapted to the chosen kernel function.

References

Scott, D.W. (1992). Multivariate Density Estimation: Theory, Practice, and Visualization. New York, Chichester: Wiley.

See Also

kernel.function, kde

Examples

Run this code
  ## two-dimensional data
  n <- 1000
  u <- runif(n)
  thresh <- 0.4
  x1 <- rnorm(n)*(u<thresh) +rnorm(n,mean=3)*(u>=thresh)
  x2 <- rnorm(n)*(u<thresh) +rnorm(n,mean=9)*(u>=thresh)
  bandwidth.scott( cbind(x1,x2) )

Run the code above in your browser using DataLab