Reprex (courtesy of https://easystats.github.io/blog/posts/performance_check_collinearity/):
library(glmmTMB); library(performance)
#note: needed to also install the insight package before installation of performance
data(Salamanders)
# create highly correlated pseudo-variable
set.seed(1)
Salamanders$cover2 <-
Salamanders$cover * runif(n = nrow(Salamanders), min = .7, max = 1.3)
# fit mixed model with zero-inflation
model <- glmmTMB(
count ~ spp + mined + cover + cover2 + (1 | site),
ziformula = ~ spp + mined,
family = truncated_poisson,
data = Salamanders
)
# now check for multicollinearity
check_collinearity(model)
The performance package offers check_collinearity function that handles ME models:
library(performance)
check_collinearity(model)
# Check for Multicollinearity
#--------------------------------------------------------
* conditional component:
Low Correlation
Parameter VIF Increased SE
spp 1.07 1.04
mined 1.17 1.08
High Correlation
Parameter VIF Increased SE
cover 19.30 4.39
cover2 19.12 4.37
* zero inflated component:
Low Correlation
Parameter VIF Increased SE
spp 1.08 1.04
mined 1.08 1.04