predict.earth {earth} | R Documentation |
Predict with an 'earth' model.
## S3 method for class 'earth': predict(object, newdata, ..., type=c("response", "terms"))
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. |
If type="response"
, a vector of predicted values.
If type="terms"
, a matrix with each column showing the contribution of a predictor.
data(trees) a <- earth(Volume ~ ., data = trees) predict(a) # same as a$fitted.values predict(a, c(10,80)) # yields 17.76888