predict.bagEarth {caret} | R Documentation |
Predicted values based on bagged Earth and FDA models
## S3 method for class 'bagEarth' predict(object, newdata = NULL, type = "response", ...) ## S3 method for class 'bagFDA' predict(object, newdata = NULL, type = "class", ...)
object |
Object of class inheriting from |
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 |
The type of prediction. For bagged |
... |
not used |
a vector of predictions
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 from 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.
Max Kuhn
## Not run: data(trees) ## out of bag predictions vs just re-predicting the training set fit1 <- bagEarth(Volume ~ ., data = trees, keepX = TRUE) fit2 <- bagEarth(Volume ~ ., data = trees, keepX = FALSE) hist(predict(fit1) - predict(fit2)) ## End(Not run)