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 provided variables?
Am I doing something wrong?
Wrong is that you expect the result to be always better if the tree is larger.
Try the iris data, for example, and find that your assumptions are not always wrong. ;-)
Best wishes, Uwe
# Classification Tree with rpart library(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, Claudia [[alternative HTML version deleted]] ______________________________________________ R-help@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@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.