Hi all,
Does anyone know how I can do kfolds cross-validation by leaving one upper-level unit out instead of each observation in a brms model fitted on a hierarchical dataset? loo currently does the latter but not the former.
For example, using the public cbpp dataset from package lme4, this is what I have so far.
mod3 ← brm(incidence ~ sizeR + (1 + sizeR | herd), data = cbpp)
kfold(mod3, chains = 1, group = “herd”, folds = “group”)
However, kfolds does not seem to be leaving out each upper level unit (herd), instead it’s fitting on the lower level unit (cattles).
Thank you!