rpart
object.predict.rpart(object, newdata=list(), type=c("vector", "tree"))
rpart
. This is assumed to be the result
of some function that produces an object with the same named
components as that returned by the rpart
function.formula(object)
must
be present by name in newdata
. If missing, the fitted values are returned.rpart
object.type="vector"
:
vector of predicted responses or, if the response is a factor, matrix
of predicted class probabilities. This 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.
if type="tree"
an object of class rpart
is returned with new values for frame$n
and
frame$yval
(and frame$yprob
if it exists).rpart
. It can be invoked by calling predict for an object of the
appropriate class, or directly by calling predict.rpart
regardless of
the class of the object.predict
, rpart.object
data(car.test.frame)
z.auto <- rpart(Mileage ~ Weight, car.test.frame)
predict(z.auto)
Run the code above in your browser using DataLab