predict.arbor
Predictions from a Arbor Object

Description

Returns a vector of predicted responses from an arbor object and new data.

Usage

predict.arbor(object, newdata = list(),
              type = c("vector", "matrix", "tree", "class", "prob"))

Arguments

object fitted model object of class arbor. This is assumed to be the result of some function that produces an object with the same named components as that returned by the arbor function.
newdata data frame containing the values at which predictions are required. The predictors referred to in the right side of formula(object) must be present by name in newdata. If missing, the fitted values are returned.
type character string denoting how the predictions are returned. The default is vector.

Details

This function is a method for the generic function predict for class arbor. It can be invoked by calling predict for an object of the appropriate class, or directly by calling predict.arbor regardless of the class of the object.
The new object is obtained by dropping newdata down object. For factor predictors, if an observation contains a level not used to grow the tree, it is left at the deepest possible node and frame\$yval at the node is the prediction.
Value
if type = "vector": vector of predicted responses.
if type = "matrix": either a matrix of predicted class probabilities and class counts (for classification problem), or number of events at a node (for poisson or exponential methods), along with the predicted responses. If the input object does not have a yval2 (i.e. anova method was used) then the vector of predicted responses is returned.
if type = "class" : vector of predicted factor responses, if method is classification.
if type = "prob": returns a vector or a matrix (as appropriate) of class probabilities.
See Also
predict, arbor.object xpred.arbor
Examples
library("arbor")
data(car.test.frame, package = "Sdatasets")
z.auto <- arbor(Mileage ~ Weight, car.test.frame)
predict(z.auto)
nd <- data.frame(Weight = c(2000, 2500, 3000))
predict(z.auto, newdata = nd)

data(kyphosis, package = "Sdatasets") fit1 <- arbor(Kyphosis ~ Age + Number + Start, data=kyphosis) predict(fit1, type = 'class')

Package arbor version 6.1.1-7
Package Index