Skip to content
Prev 14698 / 20628 Next

K-fold cross validation of GLMMs

Teresa Oliveira <mteresaoliveira92 at ...> writes:
I don't know of a package offhand.  (I haven't tried, but I
*strongly* recommend the 'sos' package; the findFn() command does
a full-text search of packages on CRAN ...)

  This is going to be a little bit tricky because you really ought
to cross-validate at the level of the grouping factor, not at the
level of the individual observation (this is assuming you have
only a single grouping factor, or at worst nested grouping factors).
Given a specified loss/objective function, it shouldn't be too hard
to put together a loop that would do this; it might even be possible
to use the modular structure of merMod objects to avoid redoing some
of the expensive computations each time round.
  Perhaps someone has done some of this and could share code ... ?