predict.tree(object, newdata = list(), type= c("vector", "tree", "class"), split=F, nwts, eps=1e-3)
object
|
fitted model object of class tree . This is assumed to be the result
of some function that produces an object with the same named
components as that returned by the tree 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, fitted values are returned.
|
type
| character string denoting whether the predictions are returned as a vector (default) or as a tree object. |
split
|
governs the handling of missing values. If false, cases with missing
values are dropped down the tree until a leaf is reached or a node for which
the attribute is missing, and that node is used for prediction. If
split = T cases with missing attributes are split into fractional
cases and dropped down each side of the split. The predicted values
are averaged over the fractions to give the prediction.
|
nwts
|
weights for the newdata cases, used when predicting a tree.
|
eps
|
a lower bound for the probabilities, used if events of predicted
probability zero occur in newdata when predicting a tree.
|
predict()
for class tree
.
It can be invoked by calling predict(x)
for an
object x
of the appropriate class, or directly by
calling predict.tree(x)
regardless of the
class of the 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
or frame$yprob
at that
node is the prediction.
if type="tree"
:
an object of class "tree"
is returned with new values
for frame$n
and frame$dev
. If
newdata
does not contain a column for the response in the formula
the value of frame$dev
will be {NA}, and if some values in the
response are missing, the some of the deviances will be NA
.
if type="class"
:
for a classification tree, a factor of the predicted classes (that
with highest posterior probability, with ties split randomly).
predict
, tree.object
.