Sampling unspecified priors in brms

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

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

2 Likes

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

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

Building off of this, a bit, is it possible to assign parameters from other classes the improper flat prior across the reals? For example, take a simple Gaussian model y ~ x. Would it be possible to use the improper flat prior for both the intercept and for sigma?

[Note: I’m doing this for pedagogical purposes, not for a substantive data analysis.]