Prior predictive checks in brms

Bayesian workshop - STEP 2023

Scott James Perry

University of Alberta

By the end of this lesson you will be able to…

  • Explain why we do prior predictive checks
  • Use brms to check what assumptions our priors are putting in our models

What is a prior check?

Bayesian models are generative, and so they can go both ways:

  • We give them data, they give us parameters
  • If we have some parameters, we can ask them for data
  • Fit a model with only our priors, then ask it to simulate data

What is the goal?


  • Goal: limit parameter space so HMC can work well

  • In complex models, priors are needed for identifiability - must be reasonable

What is the goal?


  • Goal: limit parameter space so HMC can work well

  • In complex models, priors are needed for identifiability - must be reasonable



We don’t need to put all our scientific information in, just make our assumptions not crazy

How to do this in brms


  • We can use the sample_prior argument and set it to “only”
  • This will ignore the data and fit a model just with your priors



model_fit <- brm(...,
                 sample_prior = "only",
                 ...)

Let’s run prior predictive checks for ourselves



Let’s all open the script S3_E2_prior_simulation.R