- Operating System: WIndows 10
- brms Version: 2.4.0
Hi all,
I’m trying to determine which variables explain the variation in a binary outcome (divorce yes/no) and I have 4 random intercepts that I need to take into account.
The data looks like that:
‘data.frame’: 321 obs. of 8 variables:
ProbDiv : num 1 0 1 0 1 1 0 0 0 0
stdAgeMale: num -0.534 -0.638 -0.534 -0.534 -0.326 …
stdQlty : num -0.317 -0.317 -0.317 -0.317 -0.317 …
stdQltySq :Class ‘AsIs’ num [1:321] 0.101 0.101 0.101 0.101 0.101 …
Year : num 2003 2006 1992 2007 2005 …
Site : Factor w/ 52 levels “Q11”,“Q12”,“Q13”,…: 23 23 23 23 23 23 23 23 23 23 …
BandM : Factor w/ 78 levels “118600236”,“118601116”,…: 59 75 14 75 59 14 14 14 59 14 …
BandF : Factor w/ 81 levels “118600238”,“118601133”,…: 72 57 11 57 57 39 39 39 72 11 …
IC_comp_data.txt (30.6 KB)
I initially used the glmmTMB
package but got some convergence problems with some of the models, so I tried to switch to brms
to benefit from the flexibility of Bayesian methods. However, when I compare the results from both methods (which are similar on another, simpler, dataset), the information criteria I used (AICc for glmmTMB
and WAIC for brms
) give me completely opposite results in this case. How is that possible?
Here I compare two models (see below for exact code of the models) at the opposite side of the IC table (one with site quality as a predictor, and one with male age):
For WAIC:
brms::WAIC(mod_brm_Qlty, mod_brm_Age)
WAIC SE
mod_brm_Qlty 128.24 17.52
mod_brm_Age 151.24 20.60
mod_brm_Qlty - mod_brm_Age -23.00 6.32
The model with quality has a smaller WAIC. The Rhat and effective sample size look good, so I think it’s mixing well. And I think I’m using fairly classic and uninformative priors …
For AICc:
MuMIn::AICc(mod_TMB_Qlty, mod_TMB_Age)
df AICc
mod_TMB_Qlty 7 180.6264
mod_TMB_Age 6 168.6190
Here the model with Age seem to fit the data much better. Importantly, I ran the same models with R2jags
and the DIC were similar to AICc. Any idea what could be the issue?
Here is the code for the different models
mod_brm_Qlty <- brm(ProbDiv ~ 0 + intercept + stdQlty + stdQltySq + (1|Year) + (1|Site) + (1|BandM) + (1|BandF), data = brms_data, family = bernoulli(), prior = c(set_prior("normal(0,5)", class = "b"),set_prior("student_t(3,0,5)", class = "sd")), control = list(adapt_delta = 0.99), chains = 4, iter = 10000, warmup = 1000, thin = 5, cores = getOption("mc.cores", 4), save_all_pars = TRUE, seed = 190386)
mod_brm_Age <- brm(ProbDiv ~ 0 + intercept + stdAgeMale + (1|Year) + (1|Site) + (1|BandM) + (1|BandF), data = brms_data, family = bernoulli(), prior = c(set_prior("normal(0,5)", class = "b"),set_prior("student_t(3,0,5)", class = "sd")), control = list(adapt_delta = 0.99), chains = 4, iter = 10000, warmup = 1000, thin = 5, cores = getOption("mc.cores", 4), save_all_pars = TRUE, seed = 190386)
mod_TMB_Qlty <- glmmTMB(ProbDiv ~ stdQlty + stdQltySq + (1|Year) + (1|Site) + (1|BandM) + (1|BandF), family = "binomial", control = glmmTMBControl(optCtrl = list(iter.max = 1000, eval.max = 1000), profile = TRUE), data = brms_data)
mod_TMB_Age <- glmmTMB(ProbDiv ~ stdAgeMale + (1|Year) + (1|Site) + (1|BandM) + (1|BandF), family = "binomial", data = brms_data)
There seem to be quite big differences in the estimates between the two methods too.
Models with nest quality:
brms::fixef(mod_brm_Qlty)
Estimate Est.Error Q2.5 Q97.5
intercept -5.708118 1.856913 -10.103616 -2.9456789
stdQlty -3.859118 1.998710 -8.241969 -0.4253715
stdQltySq -2.708594 2.157818 -7.349208 1.1732692
glmmTMB::fixef(mod_TMB_Qlty)
Conditional model:
(Intercept) stdQlty stdQltySq
-3.0912 -1.8143 -0.8036
Models with age:
brms::fixef(mod_brm_Age)
Estimate Est.Error Q2.5 Q97.5
intercept -4.968025 1.315884 -8.135548 -3.098368
stdAgeMale -3.620256 1.280105 -6.432338 -1.432056
glmmTMB::fixef(mod_TMB_Age)
Conditional model:
(Intercept) stdAgeMale
-3.525 -2.906
Thanks for your help!