predict.locfit {locfit}R Documentation

Prediction from a Locfit object.

Description

The locfit function computes a local fit at a selected set of points (as defined by the ev argument). The predict.locfit function is used to interpolate from these points to any other points. The method is based on cubic hermite polynomial interpolation, using the estimates and local slopes at each fit point.

The motivation for this two-step procedure is computational speed. Depending on the sample size, dimension and fitting procedure, the local fitting method can be expensive, and it is desirable to keep the number of points at which the direct fit is computed to a minimum. The interpolation method used by predict.locfit() is usually much faster, and can be computed at larger numbers of points.

Usage

## S3 method for class 'locfit':
predict(object, newdata, where="fitp", se.fit=FALSE,
               band="none", what="coef", ...)

Arguments

object Fitted object from locfit().
newdata Points to predict at. Can be given in several forms: vector/matrix; list, data frame.
where An alternative to texttt{newdata}. Choices include "grid" for the grid lfmarg(object); "data" for the original data points and "fitp" for the direct fitting points (ie. no interpolation).
se.fit If TRUE, standard errors are computed along with the fitted values.
band Compute standard errors for the fit and include confidence bands on the returned object. Default is "none". Other choices include "global" for bands using a global variance estimate; "local" for bands using a local variance estimate and "pred" for prediction bands (at present, using a global variance estimate). To obtain the global variance estimate for a fit, use rv. This can be changed with rv<-. Confidence bands, by default, are 95 To change the critical value or confidence level, or to obtain simultaneous instead of pointwise confidence, the critical value stored on the fit must be changed. See the kappa0 and crit functions.
what What to compute predicted values of. The default, what="coef", works with the fitted curve itself. Other choices include "nlx" for the length of the weight diagram; "infl" for the influence function; "band" for the bandwidth; "degr" for the local polynomial degree; "lik" for the maximized local likelihood; "rdf" for the local residual degrees of freedom and "vari" for the variance function. The interpolation algorithm for some of these quantities is questionable.
... Additional arguments to preplot.locfit.

Value

If se.fit=F, a numeric vector of predictors. If se.fit=T, a list with components fit, se.fit and residual.scale.

Examples

data(ethanol)
fit <- locfit(NOx~E,data=ethanol)
predict(fit,c(0.6,0.8,1.0))

[Package locfit version 1.1-9 Index]