Hi all,
I’m using the following code to generate a prior predictive distribution
priorpred<-"
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);
}
}
"
m1priorpred<-stan(model_code=priorpred,
data=data.list,
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,
David