Hi,
i am currently having two issues using brms models in R.
1st: Divergent transitions.
i am having a lot of trouble getting rid of the last few divergent transitions on my models. I have 7 models in total, and i am investigating the the effects of fire severity on 45 species. Around 15/45 species will give a divergent transition for 1-2/7 models. it is rarely over 1-2 divergent transitions and the pairs and trace plots look good. In my latest run i increased the iterations to 20k, with a 5k warmup, and thinned by 15, in a hope that this might resolve my issues. it did not. I have played with the priors, changing the df and the scale parameters and the current setup of 4, 0, 1 works best. Does anyone have any ideas on other ways to resolve this issue, i am completely out of ideas? the code block below is an example of one of my models.
Model without any fire severity variable
withCallingHandlers({
modeln ← brm(
as.formula(paste(species_name, " ~
scale(distance_to_perimetre) +
scale(shannon_fire_size_diversity) +
scale(ndvi) + scale(terrain_ruggedness) + scale(elevation) +
factor(period) +
(1|location) + (1|landscape) + (1|Obs) + offset(log(total_deployment_days_period))")),
family = poisson,
data = species_data,
prior = c(
prior(student_t(4, 0, 1), class = “b”), # for fixed effects
prior(student_t(4, 0, 1), class = “sd”) # for random effect standard deviations
),
save_pars = save_pars(all = TRUE),
control = list(adapt_delta = 0.9999, max_treedepth = 15),
chains = 4, iter = 20000, warmup = 5000, thin = 15
)
2nd problem: Model averaging.
When using posterior_average function, I cannot give it a list (in my case a list of species). So the code works if i write it out manually. Does anyone know a work around to this?
As an example:
Let’s say you have a list of four models:
model_list = list(m1, m2, m3, m4)
This doesn’t work:
posterior_average(model_list)
This does work:
posterior_average(model_list[1], model_list[2],model_list[3],model_list[4])
appreciate anyone help on this.