predict.bagEarth {caret}R Documentation

Predicted values based on bagged Earth and FDA models

Description

Predicted values based on bagged Earth and FDA models

Usage

predict.bagEarth(object, newdata = NULL, ...)
predict.bagFDA(object, newdata = NULL, type = "class", ...)

Arguments

object Object of class inheriting from bagEarth
newdata 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).
type bagFDA only: if type = "class" is specified, a factor of class predictions (with the same levels as the original training outcome) are returned. If type = "probs", a matrix of class probabilities (i.e. vote rates) is returned.
... not used

Value

a vector of predictions

Note

If the predictions for the original training set are needed, there are two ways to calculate them. First, the original data set can be predicted by each bagged earth model. Secondly, the predictions form each bootstrap sample could be used (but are more likely to overfit). If the original call to bagEarth or bagFDA had keepX = TRUE, the first method is used, otherwise the values are calculated via the second method.

Author(s)

Max Kuhn

See Also

bagEarth

Examples

data(trees)
fit1 <- bagEarth(Volume ~ ., data = trees, keepX = TRUE)
fit2 <- bagEarth(Volume ~ ., data = trees, keepX = FALSE)
hist(predict(fit1) - predict(fit2))


[Package caret version 2.29 Index]