Help us reparameterize those simply translated BUGS models. We’ve been meaning to do it for ages. This particular example, blocker.stan, is very badly coded given what we know now.
Those inverse-gamma priors are terrible. Use something at least weakly informative that is consistent with zero.
The normal priors are bad, but not as harmful as the inverse gamma. Use something weakly informative.
The hierarchical part of the model uses a centered parameterization—the critical change will be to make that non-centered.
As a heads-up, we kept going back-and-forth about whether we should try to implement the same bad model as was being used in BUGS, but in the end, we decided we should just apply Stan best practice. That would include putting a prior directly on sigma rather than on sigma_sq, for example.
data {
int<lower=0> N;
int<lower=0> nt[N];
int<lower=0> rt[N];
int<lower=0> nc[N];
int<lower=0> rc[N];
}
parameters {
real d;
real<lower=0> sigma_delta;
vector[N] mu;
vector[N] delta;
}
model {
rt ~ binomial_logit(nt, mu + d + sigma_delta * delta);
rc ~ binomial_logit(nc, mu);
delta ~ student_t(4, 0, 1);
mu ~ normal(0, 10);
d ~ normal(0, 10);
sigma_delta ~ student_t(4, 0, 1);
}
Go non-centered parameterization! This is why slight parameteization changes make a huge difference. And just for the record, this isn’t just for Stan—you get the same advantages reparameterizing with Gibbs samplers like BUGS/JAGS.