Prior predictive checks with brms

Hi

I am using brms (brm) to fit a model and I want to do a prior predictive check.
I know it’s possible with the argument sample_prior="only" and than calling the resulting brmsfit object via pp_check().
But I don’t want to call the brm function twice, so I thought I just set sample_prior="yes" and generate a prior predictive check on this brmsfit. But I have no idea how or if this will work at all.

df <- data.frame(y=rnorm(100),
                 weight=rlnorm(100))

#Prior predictive check with sample_prior="only"
fitPrior <- brm("y~weight", data=df, prior=prior("normal(0,5)"), 
           sample_prior = "only")

#Plots the prior predictive check
pp_check(fitPrior)

#Prior predictive check with sample_prior="yes" ?
fit <- brm("y~weight", data=df, prior=prior("normal(0,5)"), 
                sample_prior = "yes")

Hi @wati did you try it? Looks like it should work.

pp_check(fitPrior) works fine, but pp_check(fit) would plot the posterior pc not the prior pc.

Right. As a workaround you can pass the prior predicted y to pp_check manually (see the bayesplot docs).

What is the best way to generate the prior predictive, given a model fit with brms and sample_prior = TRUE, in order to then plot it with pp_check?