
Last chance! 50% off unlimited learning
Sale ends in
Predicted values based on bagged Earth and FDA models
# S3 method for bagEarth
predict(object, newdata = NULL, type = NULL, ...)# S3 method for bagFDA
predict(object, newdata = NULL, type = "class", ...)
Object of class inheriting from bagEarth
An optional data frame or matrix in which to look for variables with which to predict. If omitted, the fitted values are used (see note below).
The type of prediction. For bagged earth
regression model, type = "response"
will produce a numeric vector of
the usual model predictions. earth
also allows the user
to fit generalized linear models. In this case, type = "response"
produces the inverse link results as a vector. In the case of a binomial
generalized linear model, type = "response"
produces a vector of
probabilities, type = "class"
generates a factor vector and
type = "prob"
produces a two-column matrix with probabilities for
both classes (averaged across the individual models). Similarly, for bagged
fda
models, type = "class"
generates a factor
vector and type = "probs"
outputs a matrix of class probabilities.
not used
A vector of predictions (for regression or type = "class"
)
or a data frame of class probabilities. By default, when the model
predicts a number, a vector of numeric predictions is returned. When
a classification model is used, the default prediction is a factor vector
of classes.
# NOT RUN {
# }
# NOT RUN {
data(trees)
## out of bag predictions vs just re-predicting the training set
set.seed(655)
fit1 <- bagEarth(Volume ~ ., data = trees, keepX = TRUE)
set.seed(655)
fit2 <- bagEarth(Volume ~ ., data = trees, keepX = FALSE)
hist(predict(fit1) - predict(fit2))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab