predict.earth {earth}R Documentation

Predict with an 'earth' model

Description

Predict with an 'earth' model.

Usage

## S3 method for class 'earth':
predict(object, newdata, ..., type=c("response", "terms"))

Arguments

object An earth object. This is the only required argument.
newdata Make predictions using the newdata. Can be a dataframe, a matrix, or a vector with the same length as a row of the input matrix x. Default is NULL, meaning use object's fitted values.
... Unused, but provided for generic/method consistency.
type Type of prediction. One of:
"response" (default)
"terms" return a response suitable for termplot. Only the additive terms and the first response (for multi-response models) are returned.

Value

If type="response", the predicted values.
If type="terms", a matrix with each column showing the contribution of a predictor.

See Also

earth, predict

Examples

data(trees)
a <- earth(Volume ~ ., data = trees)
predict(a)           # same as a$fitted.values
predict(a, c(10,80)) # yields 17.76888

[Package earth version 1.0-8 Index]