I can sample from some prior distributions using a script such as
parameters{
real eta_s2;
}
model{
eta_s2 ~ normal(0,5);
}
However, I cannot sample from a lognormal distribution using a similar script:
parameters{
real<lower = 0> eta_s2;
}
model{
eta_s2 ~ lognormal(0,2);
}
Suppose the Stan scripts are called “prior.stan”. Running the second script outputs the following
prior = stan("prior.stan", iter =10000, seed = 1, chains = 1, warmup = 3000, cores = 1)
Warning messages:
1: There were 6982 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
2: There were 18 transitions after warmup that exceeded the maximum treedepth. Increase max_treedepth above 10. See
http://mc-stan.org/misc/warnings.html#maximum-treedepth-exceeded
3: Examine the pairs() plot to diagnose sampling problems
Inference for Stan model: prior2.
1 chains, each with iter=10000; warmup=3000; thin=1;
post-warmup draws per chain=7000, total post-warmup draws=7000.
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
eta_s2 2.983147e+305 NaN Inf 0 0 2.062704e+16 1.527771e+163 5.650556e+294 NaN NaN
Why does such a simple script result in so many divergent transitions?