Multilevel negative binomial ICC calculation with dummy predictors
Posted: Sun Dec 17, 2023 11:15 am
Hi,
I fit a multilevel negative binomial model where level 1 is individuals and level 2 is groups. I have also dummy variables for a couple of categorical variables. I would like to calculate ICC but I am not sure how to do so although I have looked at Leckie et al (2020) and relevant R code provided: https://www.bristol.ac.uk/cmm/media/lec ... ie2020.pdf. (pages 85 and 87, but I am particularly interested in the model in page 87; Table 2: Model 4: Two-level random-intercept negative binomial model). I am not sure because they use this code for the fix part
# Fit model
fm4 <- glmmTMB(y ~ 1 + fsm + (1|school), data = absence, family = nbinom2)
summary(fm4)
# Linear predictor
absence$xb <- predict(fm4)
head(absence)
and I wonder whether I can use a similar code with my all dummy predictors. In other words, is that linear predictor a transformation of the fitted values of my dummy predictors from the model. I have done a bit of reading about this, and I think yes, meaning it does not matter if your predictors are continuous or dummies.
I would appreciate if you could confirm if that's the case or (if not) support me with an example R code.
model <- glmmTMB(count_outcome ~ sex + ethnicity2 + ethnicity3 + ethnicity2 +
age2 + age3 + age4 +
SEC2+ SEC3+ SEC4 +
disability + (1 | group),
data = mydata,
family = nbinom2)
Many thanks,
Ferhat
I fit a multilevel negative binomial model where level 1 is individuals and level 2 is groups. I have also dummy variables for a couple of categorical variables. I would like to calculate ICC but I am not sure how to do so although I have looked at Leckie et al (2020) and relevant R code provided: https://www.bristol.ac.uk/cmm/media/lec ... ie2020.pdf. (pages 85 and 87, but I am particularly interested in the model in page 87; Table 2: Model 4: Two-level random-intercept negative binomial model). I am not sure because they use this code for the fix part
# Fit model
fm4 <- glmmTMB(y ~ 1 + fsm + (1|school), data = absence, family = nbinom2)
summary(fm4)
# Linear predictor
absence$xb <- predict(fm4)
head(absence)
and I wonder whether I can use a similar code with my all dummy predictors. In other words, is that linear predictor a transformation of the fitted values of my dummy predictors from the model. I have done a bit of reading about this, and I think yes, meaning it does not matter if your predictors are continuous or dummies.
I would appreciate if you could confirm if that's the case or (if not) support me with an example R code.
model <- glmmTMB(count_outcome ~ sex + ethnicity2 + ethnicity3 + ethnicity2 +
age2 + age3 + age4 +
SEC2+ SEC3+ SEC4 +
disability + (1 | group),
data = mydata,
family = nbinom2)
Many thanks,
Ferhat