Sampling unspecified priors in brms


#1

Hey all,

I’m trying to understand how to conduct Bayesian analyses. So far the brms package seems amazing and very easy to use. It’s basically what I’m using to understand Bayesian statistics.

One of the things that I want to understand is what the default priors are. I thought it was possible to use the brm() function to sample from the prior, using the sample_prior argument. However, when I do not specify a prior explicitly, I don’t think this does anything. Is this correct?

Or, I suppose, is there a way to visualize what the default priors are in the brms package?

Thanks!

  • Willem

#2

Hi Willem,

some parameters (in particular ordinary regression coefficients) have a so called “improper flat” prior by default, which is coded in Stan by not specifying any prior at all. No sampling can be done for such a prior.

You can see the priors explicitely in the Stan code by writing stancode(fit) where fit is your fitted model objects. Alternatively, you can obtain a summary of the applied priors via prior_summary(fit).

Paul


#3

Hi Paul,

given a specification of all priors in the model, is it easily possible to draw samples? Just asking, bacause this would allow to back-check informative priors. It is sometimes difficult to see the consequences of marginally specified priors …

Best,

Kevin


#4

You can run brm(..., sample_prior = "only") to obtain samples from the priors. Be aware that this requires all parameters to have proper priors.