I would like to create a `brmsfit`

object with a modified brms-generated Stan model. [This makes it for example easier to generate posterior predictive distributions.]

One way to do this I can think of is to

- generate a brmsfit model with a first call of brm. Lets call this
`brms_orig`

- extract the Stan model code
`brms_orig$model`

, change it and put the modified model back into the`brms_orig$model`

slot - recompile the modified
`brms_orig`

and sample from it with`brms_modified = update(brms_orig, recompile = TRUE)`

I can imagine that this works if the modified Stan model has the same parameters as the original model, but I am not sure. I am even less sure that this would work if the modified Stan model had additional parameters (e.g. to implement types of imputations brms does not support yet.)

My specific questions are:

- Does the above outlined workflow work as long as the modified Stan model has the same parameters as the original brms-generated Stan model?
- What would one need to do in addition, if the modified Stan model had additional parameters?

Thanks in advance!

Guido

##########################################################

Please also provide the following information in addition to your question:

- Operating System: Windows 10
- brms Version: 2.6