[R] rpart help please

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Jul 4 19:04:30 CEST 2002

On Thu, 4 Jul 2002, Remy X.O. Martin wrote:

> I am trying to get to grips with rpart, and find it not very easy given the
> information that comes with the package. Contrary to e.g. the ctest package docs, it
> doesn't say when "an rpart" could be used, and/or how to interpret the results. Here
> are a few of the open questions I have:

rpart is a contributed package ported from S-PLUS 6.x.  There is other
documentation on how to use it, and I suggest you search it out.

> 1) Read in ?rpart: ...method: one of.... If y is a survival object... A similar
> fleeting reference is just above under 'na.action', and there is a y=TRUE argument to
> rpart itself. I *suppose* that this refers to a formula of the form y~x, with y being
> the dependent variable -- or is this a (minor) bug in the documentation?

y is the conventional name in statistics for the response variable.

> 2) It looks like rpart and aov are in a way complementary, and should to a certain
> degree give comparable results. Is there some "user's guide" document somewhere that
> describes this in language accessible to "generic scientists" (= non-statisticians)?

There are some good introductions to doing statistics in R, and at least
one of them covers aov and rpart in depth.  And there is an FAQ for R.

> 3) I just applied rpart to a dataset, and saw something that seems counter-intuitive
> at the least: a branch is made (n=84) between fac1=A (n=28) and fac1=B,C (n=56). The
> fac1=A branch is an end-node, the fac1=B,C branch is itself branched into fac1=C (n=
> 28) and (!) fac1=A,B (n=28)! According to the n-counts, there should be no more A in
> that latter branch (or in the fac1=B,C branch in general). Do I not understand
> something essential, or is this a bug (in the branch criterion label and/or the n-
> count label)?

It is correct, so it looks as if you `do not understand something

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list