Generating samples from priors for Bayes Factors when sample_prior="no"

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

  • Operating System: Win10
  • brms Version: 2.9.0

When I ran the brm function I forgot to specify sample_prior=“yes” and it instead defaulted to sample_prior=“no”. It takes a week to run, so I’m not keen on doing it again if I can avoid it just to use the hypothesis function to compute Bayes Factors (and yes, all my priors are proper). I wondered if there was a way to run the model again with sample_prior=“only” (which I assume will run very fast in comparison) and then manually alter the original output object with sample_prior=“no” to include the information from the output object with sample_prior=“only” to trick the hypothesis function into thinking the original run was with sample_prior=“yes”. Any ideas?

Nothing built-in. You have to extract the samples using posterior_samples for instance, and then work from there manually.

Yes, that was my plan. So you are confirming it should be possible to amend the original object so that this will work?

It would be cool to have a function that could merge a sample_prior=“no” object with a sample_prior=“only” object, or update a sample_prior=“no” or sample_prior=“only” object to a sample_prior=“yes” object. I suppose if it’s not too onerous for me to generalize the code I write to solve the problem for my data, I could supply it to you as a starter function with this purpose in mind. No promises, there, though.

This wasn’t my intention to say. It may be possible to amend the original object, but the effort is huge and the process error prone. The way sample_prior = “yes” and sample_prior = “only” are generated and stored is way different, so I don’t think there will eventually be a general approach that does this automatically. Also, the user base of such a functionality would likely be restricted to people forgetting to set sample_prior = “yes” in the first place. :-D

OK, thanks for clarifying. I thought you might have meant it this way, but I wanted to be sure.