Those aren't the same models. In the JAGS model you use
a uniform(0,100) prior on the standard deviations whereas
in the Stan model you're using gamma(0.001,0.001).
I'm assuming you really mean to put this gamma prior on
precision (inverse square std dev), not on the std dev
parameter, because that would follow BUGS practice.
In our manual chapter on regression, you can find our own
recommended priors for these parameters. You probably
want tighter priors on the b parameters and something
like cauchy(0, 2.5) on the sd parameters. You have the
parameters properly constrained, so that shouldn't be a problem.
And you're using the bernoulli_logit, which is great.
To speed up Stan, there are two more things you can do.
One is to vectorize the priors, rewriting
for (g in 1:G) {
alpha[g] ~ normal(alpha_hat[g],sigma_alpha);
b1[g] ~ normal(b1_hat[g],sigma_b1);
b2[g] ~ normal(b2_hat[g],sigma_b2);
alpha_hat[g] ~ normal(0, 100);
b1_hat[g] ~ normal(0, 100);
b2_hat[g] ~ normal(0, 100);
}
as
alpha ~ normal(mu_alpha, sigma_alpha);
b1 ~ normal(b1_hat, sigma_b1);
b2 ~ normal(b2_hat, sigma_b2);
alpha_hat ~ normal(0, 100);
b1_hat ~ normal(0, 100);
b2_hat ~ normal(0, 100);
I'd also recommend changing the anmes --- "_hat" is typical
notation used for point estimates, not hierarchical priors.
We prefer something like:
b1 ~ normal(mu_b1, sigma_b1);
so you're already halfway there!
Otherwise everything looks OK. Are you trying to hand-initialize
the parameters? If so, that may be another issue. I'd try to let
Stan just do it automatically.
If you still have problems, please send us the data (or simulated
data) and the revised model.
- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
> <myJAGSmodel.txt><mySTANmodel.txt>