earth (version 0.1-2)

predict.earth: Predict with an 'earth' model

Description

Predict with an 'earth' model.

Usage

## S3 method for class 'earth':
predict(object, newdata, \dots, 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 are returned.

Value

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

See Also

earth, predict

Examples

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

Run the code above in your browser using DataLab