Re: [R] what missed ----- CART

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Sun, 24 Feb 2008 19:48:49 +0100

o ha wang wrote:
> Hi all,
>
> Can anyone who is familar with CART tell me what I missed in my tree code?
>
> library (MASS)
> myfit <- tree (y ~ x1 + x2 + x3 + x4 )

There is not function tree() in MASS. I guess you have loaded package "tree"?
Note that the author and maintainer of the tree package suggests to use package rpart instead.

> # tree.screens () # useless
> plot(myfit); text (myfit, all= TRUE, cex=0.5, pretty=0)
> # tile.tree (myfit, fgl$type) # useless
> # close.screen (all= TRUE) # useless
>
>
> My current tree plot resulted from above code shows as:
> 1. overlapped #s caused by unsuitable length of branch.
> 2. no misclassification rates: 'misclass.tree' only brings up the error of ' misclassification error rate is appropriate for factor responses only', but my response y is 0/1 data.

If you data is 0/1, you should make it a factor otherwise the cose will assume you want a regression rather than a classification tree.

> 3. Unsuitable location of notations: there are not two notation of splitting criteria on the two branches when a node is split, instead only one notation of splitting criteria is on the node location.

It indicates which items go into the left branch.

Uwe Ligges

>
> thanks,
> xiao yue
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
>
https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 24 Feb 2008 - 18:51:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 24 Feb 2008 - 22:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive