Description Usage Arguments Side Effects See Also Examples
Labels the current plot of the tree dendrogram with text.
Extends text.rpart
to also print itree
's node risk estimate
along with the fitted values.
1 2 3 4 |
x |
fitted model object of class |
splits |
logical flag. If |
label |
For compatibility with |
FUN |
the name of a labeling function, e.g. |
all |
Logical. If |
pretty |
an integer denoting the extent to which factor levels in split labels
will be abbreviated. A value of (0) signifies no abbreviation. A
|
digits |
number of significant digits to include in numerical labels. |
use.n |
Logical. If |
fancy |
Logical. If |
fwidth |
Relates to option |
fheight |
Relates to option |
est_node_risk |
If not |
use_sd |
If |
... |
Graphical parameters may also be supplied as arguments to this
function (see |
the current plot of a tree dendrogram is labeled.
text
, plot.itree
, itree
,
post.itree
, abbreviate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # from rpart:
freen.tr <- itree(y ~ ., freeny)
plot(freen.tr)
text(freen.tr, use.n=TRUE, all=TRUE)
###unique to itree, plotting node risk:
require(mlbench); data(BostonHousing)
#fit a tree:
cart <- itree(medv~.,BostonHousing,minsplit=25,minbucket=25,cp=0)
#generate theta-hat values by computing average out-of-bag loss:
## Not run:
#don't run it because of time to do the bootstrap...
theta_hats <- getOOBLoss(model_tree.obj=cart.bh,data=bh,nboot=100)
# Then for each leaf we estimate local risk by the mean in-node theta-hat.
lre <- estNodeRisk(tree.obj=cart.bh,est_observation_loss=theta_hats$avgOOBloss)
# to add the lre to the plot:
plot(cart.bh, do_node_re= TRUE, uniform=TRUE)
text(cart.bh, est_node_risk = lre)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.