bandwidth.scott: Scott's rule of thumb

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Calculates Scott's rule of thumb bandwidth vector.

Usage

1
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

Details

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

Value

d x 1 bandwidth vector used for calculation

Author(s)

Marlene Mueller

References

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

See Also

kernel.function, kde

Examples

1
2
3
4
5
6
7
  ## 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) )

Example output

Loading required package: AER
Loading required package: car
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: survival
      x1       x2 
1.510825 3.729070 

gplm documentation built on May 2, 2019, 2:10 a.m.