I run the model twice with the code below, once with sample_prior = ‘only’, and the second time with sample_prior = ‘no’ to give two fits. the model is not the best, but it serves as an example.
After checking the summary, etc. for convergence, I run mcmc_intervals for all parameters(except lp_, as it sits at one extreme).
For example, I get these two plots.
For the prior:
and for the posterior:
The prior posterior cover all the range of the data posterior, so I interpret this as indicating that the priors a no biasing the posterior. BTW, I arrived at the priors by adjusting the priors by trial and error and trying to cover all parameters listed by the get_priors function.
what do you think?
zifamily = zero_inflated_poisson(link = "log", link_zi = "logit")
sp_formula = bf(count ~ 0 + Intercept + sday + (1 +site|species), zi ~ species)
zip_prior <- c(set_prior("normal(0, 5)", class = "b"),
set_prior("lognormal(0,1)", class = "Intercept", dpar = "zi"),
set_prior("normal(-1, 5)", class = "b", dpar = "zi"),
set_prior("student_t(3,0,5)", class = "sd"))
fit_prior <-
brm(data = my_data,
family = zifamily,
formula = sp_formula,
prior = zip_prior,
iter = 2000, warmup = 1000, thin = 1, chains = 4, cores = 4,
sample_prior = 'only'
)
If possible, add also code to simulate data or attach a (subset of) the dataset you work with.
Operating System: Linux Ubuntu 22.04
Interface Version: brms on RStudio
Compiler/Toolkit