strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science
https://strengejacke.github.io/sjPlot
606 stars 91 forks source link

ICC in tab_model() for multilevel logisitic regression #798

Open guyabel opened 2 years ago

guyabel commented 2 years ago

Is it possible to revert in tab_model() to show the latent variable estimate of the ICC again for multilevel logistic regression $ICC = \frac{\sigma^2}{\sigma^2 + \frac{\pi^{2}}{3} }$

library(lme4)
library(sjPlot)
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
             data = cbpp, family = binomial)

tab_model(gm1)

image

The latent variable estimates is now given by performance::icc() when by_group = TRUE is set. Not sure why.

# shows the default result from icc()
performance::icc(gm1)
# Intraclass Correlation Coefficient
#
#     Adjusted ICC: 0.008
#  Conditional ICC: 0.007

# perhaps better to show the by_group = TRUE results? 
performance::icc(gm1, by_group = TRUE)
# # ICC by Group
#
# Group |   ICC
# -------------
# herd  | 0.124