This may be a silly question but I just can\'t find a package to do that...I know I can write some codes to get what I want but it would be nice to have a function to do it auto
I would suggest investigating cv.glm
from package boot
, because you are working with a glm model. Another option would be package cvTools
. I've found it more useful to write up my own function for CV, though. It sounds like you want a CV function that ends halfway, and most CV functions I've seen will average the prediction error over all the validation sets and return just the average (which, of course, is the definition of cross validation).