[R] rpart

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jan 18 08:27:08 CET 2005


On Mon, 17 Jan 2005, Weiwei Shi wrote:

> I am working on a classification problem by using
> rpart. when my response variable y is binary, the
> trees grow very fast, but if I add one more case to y,
> that is making y has 3 cases,

Do you mean 3 classes?: you have many more than 3 cases below.

> the tree growing cannot be finished.

Whatever does that mean?  Please see the posting guide and supply the 
information it asks for, a reproducible example and what happens when you 
run it and why you think it is wrong.

> the command looks like:
> x<-rpart(r0$V142~.,data=r0[,1:141],
> parms=list(split='gini'), cp=0.01)
>
> changing cp or removing parms does not help.
>
> summary($V142) gives like:
>> summary(r0$V142)
>  0   1   2
> 370  14  16
>
> I am not sure if rpart can do this or there is something wrong with my 
> approach.

What is `this' you want to do?  Rpart works well with multiple classes: 
see for example MASS4.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list