[R] what missed ----- CART
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sun Feb 24 19:48:49 CET 2008
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.
More information about the R-help
mailing list