My colleague and I are fitting a range of linear and nonlinear mixed effect models in R. We are asked to perform cross-validation on the fitted models so that one can verify that the effects observed are relatively generalizable. This is normally a trivial task, but in our case, we have to split the whole data into a training part and a testing part (for CV purposes) that share no common levels. For example,
The training data may be based on Groups 1,2,3,4; The fitted model is then cross-validated on Group 5.
So this creates a problem since the group-based random effects estimated on the training data do not apply to the testing data. Thus, we cannot CV the model.
Is there a relatively straightforward solution to this? Or has anyone written a package to tackle this problem yet? Any hint is welcome!
Thanks!