cv {sm}R Documentation

Cross-validation criterion for nonparametric density estimation

Description

This function computes a cross-validatory criterion, based on integrated squared error, for use in selecting a smoothing parameter in nonparametric density estimation.

Usage

cv(x, h, h.weights=NA)

Arguments

x vector, or two-column matrix, of data.
h a smoothing parameter. In the two-dimensional case this is multiplied by the standard deviation of each component to produce two smoothing parameters
h.weights a vector of weights which multiply the smoothing parameter(s) used in the kernel function at each observation.

Details

see Section 2.4.3 of the reference below. The function is called automatically by hcv and does not usually need to be called independently.

Value

The value of the cross-validatory criterion.

Side Effects

None

References

Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for Data Analysis: the Kernel Approach with S-Plus Illustrations. Oxford University Press, Oxford.

See Also

hcv, hsj, hnorm, sj

Examples

x      <- rnorm(50)
hgrid  <- seq(0.1, 1, length = 10)
cvgrid <- vector("numeric", length = length(hgrid))
for (i in 1:10) cvgrid[i] <- cv(x, hgrid[i])
plot(hgrid, cvgrid, type="l")

[Package Contents]