These functions are used by the Tree Regression dialog.
menuTree
calls
tabSummary.tree,
tabPlot.tree,
tabPrune.tree,
tabShrink.tree
, and
tabPredict.tree
if summary, plotting, pruning, shrinking, or prediction results are requested.
a formula object, with the response on the left of a `~' operator,
and the terms, separated by
+ operators, on the right.
treeobj
an object that inherits from class
tree.
OPTIONAL ARGUMENTS:
data
a
data.frame in which to interpret the variables named in the
formula, or in the
subset and the
weights argument.
If this is missing, then the variables in the formula should be on the
search list.
weights
vector of observation weights.
The length of
weights must be the same as the number of observations.
The weights must be nonnegative and it is strongly recommended that they
be strictly positive, since zero weights are ambiguous, compared to use
of the
subset argument.
subset
expression saying which subset of the rows of the data
should be used in the fit.
This can be a logical vector (which is replicated to have length equal
to the number of observations), or a numeric vector indicating which
observation numbers are to be included, or a character vector of the
row names to be included.
All observations are included by default.
na.omit.p
if
TRUE, then any observation with missing values are removed
from the analysis.
If
FALSE and there are missing values then the function will exit
with a message that missing values are not allowed.
If
na.omit.p is
TRUE then
na.action is set to
na.omit in the
call to
tree.
If
na.omit.p is
FALSE then
na.action is set to
na.fail in the
call to
tree.
mincut
minimum number of observations to include before the
first cut on a variable. See the help file for
tree.control for more
details on this and other fitting options.
minsize
node size at which the last split is performed, i.e.
minsize == 5 means that growing continues if there are at
least
5 observations in a node. See the help file for
tree.control for more
details on this and other fitting options.
mindev
minimum node deviance before growing stops. See the help file for
tree.control for more
details on this and other fitting options.
print.summary.p
if
TRUE, a short summary of the tree model fitted is printed.
This output is from the function
summary.tree.
print.tree.p
if
TRUE, the full fitted tree is printed.
This output is from the function
print.tree.
save.name
a character string for the name of the data frame to save the
fit and residuals in.
If data frame with this name already exists in database 1 and it has the
appropriate number of rows then the saved values will be appended
to the data frame.
If the object already exist in database 1 and it is not a data frame
or it does not have the appropriate number of rows then a new name
is created by appending a number to
save.name and the results are
saved in the data frame with the new name.
saveRsdMisclass
if
TRUE, the misclassification errors are returned in
save.name..
saveRsdPearson
if
TRUE, the Pearson residuals from the regression are saved in the
data frame
save.name.
saveRsdDeviance
if
TRUE, residuals of type
"deviance" are returned in
save.name.
plot.it
if
TRUE, a plot of the fitted tree will be produced.
plotUniform
if
TRUE, the plot of the tree will have branches uniformily sized. The
default is to plot the branches with sizes proportional to node deviance.
plot.addText
if
TRUE, text labels will be added at each node on the dendrogram.
plot.addText.what
select what the labels at each node should be. Choices are "Response Value"
(default), "Node Size", or "Node Deviance".
prune.p
if
TRUE, the resulting tree will be pruned. The result will then be
saved in an object named with the string given in
reduced.saved.tree.
prune.k
cost-complexity parameter defining either a specific
subtree of tree (
prune.k a scalar) or the (optional) sequence of
subtrees minimizing the cost-complexity measure (
prune.k a
vector). If missing,
prune.k is determined algorithmically.
prune.best
integer specifying the size (number of terminal nodes) of a specific
subtree in the cost-complexity sequence to be returned. This is an
alternative way to select a subtree than by supplying a scalar cost-
complexity parameter
prune.k.
reduced.newdata
the name of a data frame containing values are which predictions are
required. The sequence of optimally reduced (shrunken or pruned) trees
is evaluated on newdata. If missing, the data used to grow the tree are used.
prune.method
select one of two possibilities,
"deviance" or
"misclass".
It denotes the measure of node heterogeneity used to guide cost-complexity
pruning.
shrink.p
if
TRUE, the resulting tree will be shrunken. The result will then be
saved in an object named with the string given in
reduced.saved.tree.
shrink.k
the value of the shrinkage parameter of each tree in the sequence.
reduced.saved.tree
a character string. Results from pruning or shrinking a tree will be saved
in an object with that name, or a derivative of the string, if an object
with that name already exists. It defaults to
"last.pruned" for pruned
trees, or
"last.shrunken" for shrunken ones.
plot.seq
if
TRUE, a plot of the optimal tree sequence that is obtained for the
various values given as shrinkage scalars or pruning tree sizes.
It displays the value of the deviance for each reduced tree.
predict.newdata
a data frame to use for computing predictions.
It must contain the same names as the terms in the right side of the
formula for the model.
If missing, the predictions for the original data are computed.
predict.type
selection that denotes whether the predictions are to be returned as a
vector (default) or as a tree object.
predict.save.name
a character string for the name of the object to save the
predictions in.
If an object with this name already exists in database 1
another name will be generated by appending an integer to the
string given.
VALUE:
an object of class
tree. See the
tree.object help file for details.