[R] Regression tree: labels in the terminal nodes
Achim.Zeileis at wu-wien.ac.at
Thu Aug 16 15:59:38 CEST 2007
On Thu, 16 Aug 2007, Juergen Kuehn wrote:
> Dear everybody,
> I'm a new user of R 2.4.1 and I'm searching for information on improving
> the output of regression tree graphs.
> In the terminal nodes I am up to now able to indicate the number of
> values (n) and the mean of all values in this terminal node by the command
> > text(tree, use.n=T, xpd=T)
Note that this is specific to the "rpart" implementation. There are also
other recursive partitioning algorithms available, see e.g., the
"MachineLearning" task view at
The ctree() algorithm in package "party" provides more flexibility
concerning visualization. The plotting methods are all extensible although
this is not extensively documented.
Maybe you also want to look at Simon Urbanek's interactive KLIMT software
for tree visualization.
> Yet I would like to indicate automatically in the output graph of the
> tree some quality measure, e.g. impurity (or standard deviation .....)
> and a character to identify which cases are in one terminal node, e.g.
> given a ID number or name.
> Until now I did not discover in my R help scripts or in the R programm
> help how to do it. So I calculate impurity by hand, and I'm identifying
> the cases in each node "by hand", and I am adding these values with a
> graphical software to the graph (as e.g. given "*.jpg" file). Therefore
> anybody can see that I added these values by hand. I'm quite sure that
> there is a more easy and faster way which looks (and is!) more professional.
> Could anybody help me? That would be great!
> Thank you very much for your support!
> Dr. Jürgen Kühn
> Leibniz-Centre for Agricultural Landscape Research (ZALF)
> Institute of Soil Landscape Research_
> Eberswalder Str. 84
> D-15374 Müncheberg
> Tel.: ++49/(0)33432/82-123
> Fax: ++49/(0)33432/82-280
> E-mail: Juergen.Kuehn at zalf.de <mailto:Juergen.Kuehn at zalf.de>
> Internet: http://www.zalf.de/home_zalf/institute/blf/blf/
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help