Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lscv

Least Squares Cross Validation Statistic.


Description

The calling sequence for lscv matches those for the locfit or locfit.raw functions. Note that this function is only designed for density estimation in one dimension. The returned object contains the least squares cross validation score for the fit.

The computation of \int \hat f(x)^2 dx is performed numerically. For kernel density estimation, this is unlikely to agree exactly with other LSCV routines, which may perform the integration analytically.

Usage

lscv(x, ..., exact=FALSE)

Arguments

x

model formula (or numeric vector, if exact=T)

...

other arguments to locfit or lscv.exact

exact

By default, the computation is approximate. If exact=TRUE, exact computation using lscv.exact is performed. This uses kernel density estimation with a constant bandwidth.

Value

A vector consisting of the LSCV statistic and fitted degrees of freedom.

See Also

Examples

# approximate calculation for a kernel density estimate
data(geyser, package="locfit")
lscv(~lp(geyser,h=1,deg=0), ev=lfgrid(100,ll=1,ur=6), kern="gauss")
# same computation, exact
lscv(lp(geyser,h=1),exact=TRUE)

locfit

Local Regression, Likelihood and Density Estimation

v1.5-9.4
GPL (>= 2)
Authors
Catherine Loader [aut], Jiayang Sun [ctb], Lucent Technologies [cph], Andy Liaw [cre]
Initial release
2020-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.