R: Predict with a varmod model

predict.varmod {earth} | R Documentation

## 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

`predict.earth` `varmod`

### 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)

[Package earth version 5.1.2 Index]