[R] cross-validation in rpart

From: Sam Stewart <rhelp.stats_at_gmail.com>
Date: Thu, 03 Jul 2008 11:04:02 -0300

Hello list,

I'm having a problem with custom functions in rpart, and before I tear my hair out trying to fix it, I want to make sure it's actually a problem. It seems that, when you write custom functions for rpart (init, split and eval) then rpart no longer cross-validates the resulting tree to return errors. A simple test is to use the usersplits.R function to get a simple, custom rpart function, and then change fit1 and fit2 so that the both have xvals of 10. The problem occurs in that the cptable for fit1 doesn't have xerror or xstd, despite the fact that the cross-validation is set to 10-fold.

I guess I just need conformation that cross-validation doesn't work with custom functions, and if someone could explain to me why that is the case it would be greatly appreciated.

Sam Stewart

Sam Stewart, MMath
Research Statistician, Diagnostic Imaging
Rm 3016, 3 South Victoria Building
VG Site, QEII Health Sciences Centre
1278 Tower Rd, Halifax, NS, B3H 2Y9

	[[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.
Received on Thu 03 Jul 2008 - 14:07:25 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 Mon 07 Jul 2008 - 14:31:24 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