Hi I’ve been using brms for one of project. I had to take the code and rewrite it for performance reasons. Just wondering if was possible to get the Stan fit object back into a form to use all the wonderful brms plotting and other utility functions?
Yes, you can use the empty = TRUE
argument in brms::brm
to initialise a brmsfit
object, and then fill its fit
slot with your rstan / cmdstanr output, followed by a call to the brms function rename_pars
. See that function’s documentation for an example: Rename parameters in brmsfit objects — rename_pars • brms
EDIT: If you’re using cmdstanr for fitting the model, you first need to use the function read_csv_as_stanfit
to convert the CmdStan CSV output files into a stanfit
object that is suitable for the fit
slot of the brmsfit
object. See the documentation for details.
4 Likes