I tried a model which seems to be simple…
model2 <- brm(count | trials(allcount) ~ 1 + superregion + region,data = datause, family = binomial, init = '0', thin = 10, chains = 5, iter = 5000)
But I could not fix the divergence…
So what shoud I do to fix it or why there are such errors？
Thanks in advance! Looking forward to your reply!
I don’t think much can be said without access to the data. Perhaps the model is degenerate (e.g. if there are superregions that contain only one region in the data).
Hi Jsocolar, thanks very much for your timely reply!!! So, even if one parameter is divergent, the full model will be reported as degeneration? I do not think superregions contain only one region in the data, but some of them only contains very limited number of regions (2, 3, 4 regions), some of them contains tens of regions, could it be the reason?
you need to simplify here. Try dropping region and consider modelling these things as hierarchical model with random effects instead… and also think about priors which are plausible here and use them.
I think there might be some confusion in terms here. “divergent” has a particular technical meaning in HMC model fitting. If you are seeing divergences, then that is definitely a problem for the whole model, but these divergences are not associated with any particular parameter. Your posts don’t contain information about whether or not you are seeing divergences; the Stan interface you are using should warn you if you are.
You plots also show complete lack of mixing for at least two parameters, and given the simplitcity of the likelihood it seems probable that this issue arises due to a degenerate posterior. Here again, I am using “degenerate” in a fairly specific sense that is very well explained by @betanalpha here Identity Crisis. A degeneracy of this sort is often a problem for the whole model, and it almost certainly makes model fitting inefficient. In some circumstances, it might not pose a huge problem for making predictions from the model, but in general you cannot trust inference from a model that behaves like this. @wds15’s advice to simplify is the correct way forward.