ICC / variance decomposition for multiple grouping variables in brms model

87 views Asked by At

say I have a brms model in R with two partially crossed grouping variables, the formula looks like this:

dv ~ 1 + (1 | group) + (1 | participant)

(It's just a baseline model, so there's no predictor besides the grouping variables yet)

How would I go about calculating the ICC for each grouping variable ("group" and "participant")? I understand I need to use the variance_decomposition function from the performance package, but I don't quite understand the instructions in the documentation.

It says "Variance decomposition for brms-models If model is of class brmsfit, icc() might fail due to the large variety of models and families supported by the brms package. In such cases, variance_decomposition() is an alternative ICC measure. The function calculates a variance decomposition based on the posterior predictive distribution. In this case, first, the draws from the posterior predictive distribution not conditioned on group-level terms (posterior_predict(..., re_formula = NA)) are calculated as well as draws from this distribution conditioned on all random effects (by default, unless specified else in re_formula) are taken. Then, second, the variances for each of these draws are calculated. The "ICC" is then the ratio between these two variances. This is the recommended way to analyse random-effect-variances for non-Gaussian models. It is then possible to compare variances across models, also by specifying different group-level terms via the re_formula-argument.

Sometimes, when the variance of the posterior predictive distribution is very large, the variance ratio in the output makes no sense, e.g. because it is negative. In such cases, it might help to use robust = TRUE."

What do I have to specify in re_formula to get ICCs for both grouping variables?

0

There are 0 answers