I have been having trouble getting a betabinomial mutlvariate regression with splines to converge using the default priors in brms. It was recommended to me to use an R2D2 prior with main=TRUE. However I am having trouble getting the prior to work.
Briefly I am conducting a longitudinal multivariate regression in brms of three count outcomes - days of heroin, cannabis, and alcohol use in the previous 28-day measurement period - based on days of amphetamine use at start of treatment. This is the dataset
atsUseInOTP_alloutcomes_noMissing_di.RData (8.4 KB)
And this is the model I am trying to run
bform_spline2_mvr <- bf(mvbind(cann28, alc28, heroin28) | trials(set) ~ ats_baseline + s(yearsFromStart) + s(yearsFromStart, ats_baseline) + (1|p|encID))
#
fit_mvr_spline2 <- brm(formula = bform_spline2_mvr,
family = beta_binomial(),
data = d,
seed = 1234,
refresh = 0,
chains = 4,
cores = 4,
warmup = 1e3,
iter = 3e3)
Now this works but leads to huge numbers of divergent transitions and ESS of 10-20. I suggest not running it as it takes a long time.
Based on this case study I tried a version of the model with an R2D2 prior, as follows
fit_mvr_spline <- brm(formula = bform_spline2_mvr,
family = beta_binomial(),
data = d,
prior = prior(R2D2(mean_R2 = 1/3,
prec_R2 = 3,
cons_D2 = 1/3,
main = TRUE),
class = b),
save_pars = save_pars(all=TRUE),
seed = 1234,
refresh = 0,
chains = 4,
cores = 4,
warmup = 1e3,
iter = 3e3)
But I get the following error message
Error: The following priors do not correspond to any model parameter:
b ~ R2D2(mean_R2 = 1/3, prec_R2 = 3, cons_D2 = 1/3, main = TRUE)
Function 'default_prior' might be helpful to you.
I’ve treid removing arguments and different values, and different classes but to no avail. Can anyone tell me what I’m doing wrong?
