[R-sig-ME] K-fold cross validation of GLMMs

Ben Bolker bbolker at gmail.com
Fri Jul 15 18:07:23 CEST 2016

Teresa Oliveira <mteresaoliveira92 at ...> writes:

> Dear list members,
> I would like to know if you have knowledge about any R-package that allows
> to perform k-fold cross validation of a GLMM (developed with
> "lme4::glmer()")?
> If there is none, which other kind of cross validation do you think is
> appropriate, and which packages are available?
> Or which other way to validate GLMMs, rather than cross validation, do you
> propose?
> Thank you very much in advance for your help!
> Best regards,
> Teresa

  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 ... ?

More information about the R-sig-mixed-models mailing list