As @andrew-bean pointed out in our meeting this week, RBest takes care of the stanvars injection required to use MAP priors, and this may even extend to the multivariate case if we use mixmvnorm instead of mixnorm. This could be a really useful vignette for the package. Sketch from Andrew:
if(!weak){
prior_label <- prior_label |>
brms.mmrm::brm_prior_label(code = "mixnorm(map_w, map_m, map_s)",group = "pbo", time = "Month_36")
stanvars <- mixstanvar(map = control_prior)
} else if(weak){
prior_label <- prior_label |>
brms.mmrm::brm_prior_label(code = "student_t(4, 0, 5)", group = "pbo", time = "Month_36")
stanvars <- NULL
}
prior <- brms.mmrm::brm_prior_archetype(label = prior_label, archetype = archetype)
formula <- brms.mmrm::brm_formula(archetype)
stanvars <- RBesT::mixstanvar(map = control_prior)
options("brms.backend" = "cmdstanr")
model <- brms.mmrm::brm_model(
data = archetype,
formula = formula,
prior = prior,
stanvars = stanvars,
refresh = 0,
cores = 1,
iter = iter,
chains = chains
)
As @andrew-bean pointed out in our meeting this week,
RBesttakes care of thestanvarsinjection required to use MAP priors, and this may even extend to the multivariate case if we usemixmvnorminstead ofmixnorm. This could be a really useful vignette for the package. Sketch from Andrew: