Learn R Programming

sparr (version 0.2-2)

CV.sm: Least-squares cross-validation (LSCV) for bivariate KDE bandwidths

Description

Provides an isotropic LSCV bandwidth estimate for use in bivariate kernel density estimation, taken from the function h.select in the package sm (see Bowman and Azzalini, 1997; 2010).

Usage

CV.sm(data)

Arguments

data
An object of type data.frame, list, matrix, or ppp descr

Value

  • A single numeric value of the estimated bandwidth.

Details

This function calculates a LSCV smoothing bandwidth for kernel density estimates of bivariate data. If the data argument is a data.frame or a matrix, this must have exactly two columns containing the x ([,1]) and y ([,2]) data values. Should data be a list, this must have two vector components of equal length named x and y. Alternatively, data may be an object of class ppp (see ppp.object).

References

Bowman, A.W. and Azzalini, A. (1997), Applied Smoothing Techniques for Data Analysis: The Kernel Approach with S-Plus Illustrations. Oxford University Press Inc., New York. ISBN 0-19-852396-3. Bowman, A.W. and Azzalini, A. (2010), R package `sm': nonparametric smoothing methods (version 2.2-4), URL: http://www.stats.gla.ac.uk/~adrian/sm; http://azzalini.stat.unipd.it/Book_sm.

Examples

Run this code
data(PBC)

##PBC cases
CV.sm(PBC$data[PBC$data[,3]==1,1:2])

##PBC controls
CV.sm(PBC$data[PBC$data[,3]==0,1:2])

Run the code above in your browser using DataLab