[R] rpart, cross-validation errors question
ligges at statistik.tu-dortmund.de
Mon May 3 09:10:20 CEST 2010
On 03.05.2010 04:26, Claudia Penaloza wrote:
> I ran this code (several times) from the Quick-R web page (
> http://www.statmethods.net/advstats/cart.html) but my cross-validation
> errors increase instead of decrease (same thing happens with an unrelated
> data set).
> Why does this happen?
Since the classes are not well separable along the dimensions using the
> Am I doing something wrong?
Wrong is that you expect the result to be always better if the tree is
Try the iris data, for example, and find that your assumptions are not
always wrong. ;-)
> # Classification Tree with rpart
> # grow tree
> fit<- rpart(Kyphosis ~ Age + Number + Start,
> method="class", data=kyphosis)
> printcp(fit) # display the results
> plotcp(fit) # visualize cross-validation results
> Thank you,
> [[alternative HTML version deleted]]
> R-help at r-project.org 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