Scaling of ppc_dens_overlay for prior predictive distribution

Hi all,

I’m using the following code to generate a prior predictive distribution


data {
int n;
parameters {
real<lower=0> mu;
real<lower=0> sigma;

model {
// priors
mu ~ normal(400,10);
sigma ~ cauchy(0,3);

generated quantities {
vector[n] prior_rep;

// prior predictive

for(i in 1:n) {
prior_rep[i] = normal_rng(mu,sigma);

                  chains = 4,
                  iter = 5000)

prior_rep <- as.matrix(m1priorpred,pars="prior_rep")
plot <- ppc_dens_overlay(data.list$readscore,prior_rep[1:50,])
plot + lims(x=c(300,800),y=c(0,.009))

Everything seems to be fine, but when using ppc_dens_overlay, I get the plot as shown in the attachment.
Rplot.pdf (44.1 KB)

The plot is sensible give the parameters of the prior, but the height of the plot seems strange and I have tried many values for the ylim to correct this to no effect. I’m probably missing something and would appreciate any advise.

Thanks in advance,


Note that your observed data ranges from ~300 to ~800, but your model priors are implying that the SD around the mean is given by a cauchy(0,3) distribution - which is comparatively very narrow.

This is why your prior predictive plots have such large ‘heights’ - the prior on sigma implies that all observations should be very narrowly distributed around the mean mu, resulting in the density being concentrated in a narrow range and giving such a tall plot