Description Usage Arguments Details Value Note References See Also Examples
This function calculates the intraclasscorrelation
(icc)  sometimes also called variance partition coefficient
(vpc)  for random intercepts of mixed effects models.
Currently, merMod
, glmmTMB
stanreg
and brmsfit
objects are supported.
1 
x 
Fitted mixed effects model (of class 
... 
More fitted model objects, to compute multiple intraclasscorrelation coefficients at once. 
The ICC is calculated by dividing the betweengroupvariance (random
intercept variance) by the total variance (i.e. sum of betweengroupvariance
and withingroup (residual) variance).
The calculation of the ICC for generalized linear mixed models with binary outcome is based on
Wu et al. (2012). For Poisson multilevel models, please refere to Stryhn et al. (2006).
Aly et al. (2014) describe computation of ICC for negative binomial models.
There is a print
method that prints the variance parameters using
the comp
argument set to "var"
: print(x, comp = "var")
(see 'Examples'). The re_var
function is a convenient wrapper.
The random effect variances indicate the between and withingroup
variances as well as randomslope variance and randomslopeintercept
correlation. The components are denoted as following:
Withingroup (residual) variance: sigma_2
Betweengroupvariance: tau.00 (variation between individual intercepts and average intercept)
Randomslopevariance: tau.11 (variation between individual slopes and average slope)
RandomInterceptSlopecovariance: tau.01
RandomInterceptSlopecorrelation: rho.01
A numeric vector with all random intercept intraclasscorrelationcoefficients, or a list of numeric vectors, when more than one model were used as arguments. Furthermore, between and withingroup variances as well as randomslope variance are returned as attributes.
Some notes on why the ICC is useful, based on GraceMartin:
It can help you determine whether or not a linear mixed model is even necessary. If you find that the correlation is zero, that means the observations within clusters are no more similar than observations from different clusters. Go ahead and use a simpler analysis technique.
It can be theoretically meaningful to understand how much of the overall variation in the response is explained simply by clustering. For example, in a repeated measures psychological study you can tell to what extent mood is a trait (varies among people, but not within a person on different occasions) or state (varies little on average among people, but varies a lot across occasions).
It can also be meaningful to see how the ICC (as well as the between and within cluster variances) changes as variable are added to the model.
In short, the ICC can be interpreted as “the proportion of the variance
explained by the grouping structure in the population” (Hox 2002: 15).
Usually, the ICC is calculated for the null model ("unconditional model").
However, according to Raudenbush and Bryk (2002) or
RabeHesketh and Skrondal (2012) it is also feasible to compute the ICC
for full models with covariates ("conditional models") and compare how
much a level2 variable explains the portion of variation in the grouping
structure (random intercept).
Caution: For threelevelmodels, depending on the nested structure
of the model, the ICC only reports the proportion of variance explained
for each grouping level. However, the proportion of variance for specific
levels related to each other (e.g., similarity of level1units within
level2units or level2units within level3units) must be computed
manually. Use get_re_var
to get the betweengroupvariances
and residual variance of the model, and calculate the ICC for the various level
correlations.
For example, for the ICC between level 1 and 2:
sum(get_re_var(fit)) / (sum(get_re_var(fit)) + get_re_var(fit, "sigma_2"))
or for the ICC between level 2 and 3:
get_re_var(fit)[2] / sum(get_re_var(fit))
Aguinis H, Gottfredson RK, Culpepper SA. 2013. BestPractice Recommendations for Estimating CrossLevel Interaction Effects Using Multilevel Modeling. Journal of Management 39(6): 1490<e2><80><93>1528 (doi: 10.1177/0149206313478188)
Aly SS, Zhao J, Li B, Jiang J. 2014. Reliability of environmental sampling culture results using the negative binomial intraclass correlation coefficient. Springerplus 14(3) (doi: 10.1186/21931801340)
GraceMartion K. The Intraclass Correlation Coefficient in Mixed Models, web
Hox J. 2002. Multilevel analysis: techniques and applications. Mahwah, NJ: Erlbaum
RabeHesketh S, Skrondal A. 2012. Multilevel and longitudinal modeling using Stata. 3rd ed. College Station, Tex: Stata Press Publication
Raudenbush SW, Bryk AS. 2002. Hierarchical linear models: applications and data analysis methods. 2nd ed. Thousand Oaks: Sage Publications
Stryhn H, Sanchez J, Morley P, Booker C, Dohoo IR. 2006. Interpretation of variance parameters in multilevel Poisson regression models. Proceedings of the 11th International Symposium on Veterinary Epidemiology and Economics, 2006 Available at http://www.sciquest.org.nz/node/64294
Wu S, Crespi CM, Wong WK. 2012. Comparison of methods for estimating the intraclass correlation coefficient for binary responses in cancer prevention cluster randomized trials. Contempory Clinical Trials 33: 869880 (doi: 10.1016/j.cct.2012.05.004)
Further helpful onlineressources:
CrossValidated (2012) Intraclass correlation (ICC) for an interaction?
CrossValidated (2014) Interpreting the random effect in a mixedeffect model
CrossValidated (2014) how to partition the variance explained at group level and individual level
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  library(lme4)
fit0 < lmer(Reaction ~ 1 + (1  Subject), sleepstudy)
icc(fit0)
fit1 < lmer(Reaction ~ Days + (Days  Subject), sleepstudy)
icc(fit1)
sleepstudy$mygrp < sample(1:45, size = 180, replace = TRUE)
fit2 < lmer(Reaction ~ Days + (1  mygrp) + (Days  Subject), sleepstudy)
icc(fit2)
# return icc for all models at once
icc(fit0, fit1, fit2)
icc1 < icc(fit1)
icc2 < icc(fit2)
print(icc1, comp = "var")
print(icc2, comp = "var")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.