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

predict.varmod

Predict with a varmod model


Description

You probably won't need to call this function directly. It is called by predict.earth when that function's interval argument is used.

Usage

## S3 method for class 'varmod'
predict(
    object  = stop("no 'object' argument"),
    newdata = NULL,
    type    = c("pint", "cint", "se", "abs.residual"),
    level   = .95,
    trace   = FALSE,
    ...)

Arguments

object

A varmod object.

newdata

Make predictions using newdata. Default is NULL, meaning return values predicted from the training set.

type

Type of prediction. This is the interval argument of predict.earth. One of

"pint" Prediction intervals.

"cint" Confidence intervals. Cannot be used with newdata.

"se" Standard error of the parent model residuals.

"abs.residual" The absolute residuals of the parent model on which the residual model regresses.

level

Confidence level for the interval argument. Default is .95, meaning construct 95% confidence bands (estimate the 2.5% and 97.5% levels).

trace

Currently unused.

...

Unused, but provided for generic/method consistency.

Note

predict.varmod is called by predict.earth when its interval argument is used.

See Also

Examples

data(ozone1)

set.seed(1) # optional, for cross validation reproducibility

# note: should really use ncross=30 below but for a quick demo we don't

earth.mod <- earth(O3~temp, data=ozone1, nfold=10, ncross=3, varmod.method="lm")

# call predict.earth, which calls predict.varmod

predict(earth.mod, newdata=ozone1[200:203,], interval="pint", level=.95)

earth

Multivariate Adaptive Regression Splines

v5.3.0
GPL-3
Authors
Stephen Milborrow. Derived from mda:mars by Trevor Hastie and Rob Tibshirani. Uses Alan Miller's Fortran utilities with Thomas Lumley's leaps wrapper.
Initial release

We don't support your browser anymore

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