Skip to content

CV by rpart/mvpart

1 message · Terry Therneau

#
The rpart function allows one to give the cross-validation groups explicitly.
So if the number of observations was 10, you could use
   > rpart( y ~ x1 + x2, data=mydata, xval=c(1,1,2,2,3,3,1,3,2,1))
which causes observations 1,2,7, and 10 to be left out of the first xval
sample, 3,4, and 9 out of the second, etc.   

 I was going to write "read the manual page for control.rpart", but it seems
I forgot to put this feature into the documentation!  

	Terry Therneau