The icc function calculates the intraclass correlation (ICC) for multilevel models. The ICC represents the proportion of group-level variance to total variance. The ICC can be calculated for two or more levels in random-intercept models (Hox et al, 2018).
Note: For models with random slopes, it is generally advised to interpret with caution. According to Kreft and De Leeuw (1998, p. 63), "The concept of intra-class correlation is based on a model with a random intercept only. No unique intra-class correlation can be calculated when a random slope is present in the model." However, Snijders and Bosker (2012) offer a calculation to derive this value (equation 7.9). This equation is implemented here.
The icc function calculates the intraclass correlation for linear mixed-effects models estimated with the lme4::lmer function or generalized linear mixed-effect model estimated with the lme4::glmer function with family = binomial(link="logit"). For logistic models, the estimation method follows Hox et al. (2018, p. 107) recommendation of setting the level-1 residual variance to \(\frac{\pi^2}{3}\). For a discussion different methods for estimating the intraclass correlation for binary responses, see Wu et al. (2012).