Dear R-list, I am using the rpart/mvpart-package for selecting a right-sized regression tree by 10-fold cross-validation. My question: Is there a possibility to find out for every observation in which of the ten folds it is lying? I want to use the same folds for validating another regression method (moving averages) in order to choose the better one. Thanks a lot, Pedro --------------------------------- [[alternative HTML version deleted]]
Dear R-list, I am using the rpart/mvpart-package for selecting a right-sized regression tree by 10-fold cross-validation. My question: Is there a possibility to find out for every observation in which of the ten folds it is lying? I want to use the same folds for validating another regression method (moving averages) in order to choose the better one. Thanks a lot, Pedro --------------------------------- [[alternative HTML version deleted]]
n-fold cv is easy to be implemented in R by yourself. you can create 10 folds' samples by yourself and disable cv in rpart. Then you can use the same sample sets to compare different methods. HTH weiwei On 12/28/06, Pedro Ramirez <palmar379 at yahoo.es> wrote:> Dear R-list, > > I am using the rpart/mvpart-package for selecting a right-sized regression tree by 10-fold cross-validation. My question: Is there a possibility to find out for every observation in which of the ten folds it is lying? I want to use the same folds for validating another regression method (moving averages) in order to choose the better one. > > Thanks a lot, > Pedro > > > --------------------------------- > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III
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> On 12/28/06, Pedro Ramirez <palmar379 at yahoo.es> wrote: >> Dear R-list, >> >> I am using the rpart/mvpart-package for selecting a right-sized >> regression tree by 10-fold cross-validation. My question: Is there a >> possibility to find out for every observation in which of the ten folds >> it is lying? I want to use the same folds for validating another >> regression method (moving averages) in order to choose the better one. >> >> Thanks a lot, >> Pedro