predict.varmod: Predict with a varmod model

Description Usage Arguments Note See Also Examples

View source: R/varmod.R

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

1
2
3
4
5
6
7
8
## 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

predict.earth varmod

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Example output

Loading required package: plotmo
Loading required package: plotrix
Loading required package: TeachingDemos
       fit      lwr      upr
1 20.36631 6.791415 33.94121
2 21.58436 7.377952 35.79076
3 20.97533 7.084683 34.86598
4 18.53924 5.911608 31.16688

earth documentation built on Oct. 23, 2020, 5:08 p.m.

Related to predict.varmod in earth...