hey folks
I’m trying to use a fitted brms
model, saved to .rds
file with marginaleffects
package.
After saving and loading the model, generating posterior predictions wouldn’t work if I use non-default newdata
parameter, see the code below
brm_model = readRDS('ouad_brm_model.rds')
library(marginaleffects)
conditional_preds <- predictions(
brm_model,
newdata = datagrid(gender = c("F", "M")), # any non-default parameter returns zeros in estimates
by = "gender",
re_formula = NA
) %>%
posteriordraws()
conditional_preds %>% head()
R version 4.3.0 (2023-04-21), marginaleffects_0.9.0, brms_2.19.0. Thanks in advance for any ideas!