Learn R Programming

locfit (version 1.5-9.9)

cpplot: Compute a Cp plot.

Description

The cpplot function loops through calls to the cp function (and hence to link{locfit}), using a different smoothing parameter for each call. The returned structure contains the Cp statistic for each fit, and can be used to produce an AIC plot.

Usage

cpplot(..., alpha, sig2)

Value

An object with class "gcvplot", containing the smoothing parameters and CP scores. The actual plot is produced using

plot.gcvplot.

Arguments

...

arguments to the cp, locfit functions.

alpha

Matrix of smoothing parameters. The cpplot function loops through calls to cp, using each row of alpha as the smoothing parameter in turn. If alpha is provided as a vector, it will be converted to a one-column matrix, thus interpreting each component as a nearest neighbor smoothing parameter.

sig2

Residual variance. If not specified, the residual variance is computed using the fitted model with the fewest residual degrees of freedom.

See Also

locfit, locfit.raw, gcv, aic, plot.gcvplot

Examples

Run this code
data(ethanol)
plot(cpplot(NOx~E,data=ethanol,alpha=seq(0.2,1.0,by=0.05)))

Run the code above in your browser using DataLab