Dear community,
I would like to ask about what seems to be a problem that I am experiencing in fitting a brms model to count data. The model specification below results in a fit with a relatively low ESS (~1000-1200) given 4000 post-warmup iterations. This appears to have to do with the fact that the by-subject random slopes for c_gram are heavily correlated with each other. (R>.95). Incidentally, the random slopes also show a strong negative correlation with the fixed effect for c_gram.
Is this expected behavior under some circumstances, or did I miss something about the specification of my model?
I attach the data here acc_data.csv (587 Bytes)
fit <- brm( Nyes|trials(Ntotal) ~ 1 + c_gram + (c_gram + 1|1|subject),
data = df, family = binomial(),
iter = 2000, chains = 4, cores = 4, seed = 1234 )
The code below displays the correlation coefficients.
cor_z <- posterior_samples(fit) %>% cor() %>% as.data.frame()
cor_z[lower.tri(cor_z, diag = T)] <- NA
cor_z %<>% cbind(., name_a=rownames(.))
cor_z %<>% tidyr::pivot_longer(-name_a, names_to = "name_b", values_to = "r")
cor_z %<>% subset(!is.na(r))
cor_z %<>% arrange(desc(r))
# correlation coefficients between random slopes are >0.95
head(cor_z)
# correlation coefficients between random slopes and the fixed effect are <-0.95
tail(cor_z)
I fitted the model on Linux, using R 4.0.0, brms version 2.12.9.