Hi! I’m trying to fit the following model with a hierarchal structure to the behavioral data, and the traceplot shows the weirdest shape. Also when i tried running with multiple chains, some chains would not fit at all and run infinitely. (I guess it’s stuck somewhere?) I really can’t see any problem on my own, and was hoping for some help.

```
data {
int<lower=1> N;
int<lower=1> T;
int<lower=0> Tsubj[N];
int<lower=0> pumps[N, T];
int<lower=0, upper=1> explosion[N,T];
}
parameters {
vector[4] mu_pr;
vector<lower=0>[4] sigma;
vector[N] alpha_pr;
vector[N] beta_pr;
vector[N] gam_pr;
vector[N] tau_pr;
}
transformed parameters {
vector<lower=0>[N] alpha;
vector<lower=0>[N] beta;
vector<lower=0>[N] gam;
vector<lower=0>[N] tau;
alpha = exp(mu_pr[1] + sigma[1] * alpha_pr);
beta = exp(mu_pr[2] + sigma[2] * beta_pr);
gam = exp(mu_pr[3] + sigma[3] * gam_pr);
tau = exp(mu_pr[4] + sigma[4] * tau_pr);
}
model {
mu_pr ~ normal(0, 1);
sigma ~ normal(0, 0.2);
alpha ~ normal(0, 1);
beta ~ normal(0, 1);
gam ~ normal(0, 1);
tau ~ normal(0, 1);
for(j in 1:N) {
int n_succ = 0;
int n_pump = 0;
for (k in 1:Tsubj[j]) {
int I = 128;
real p_deflate;
vector[I] curUtil;
p_deflate = (alpha[j] + (n_pump-n_succ)) / (beta[j] + n_pump);
for( l in 1:I) {
curUtil[l] = (1-p_deflate^l)*(I-l)^gam[j];
}
pumps[j,k] ~ categorical_logit(curUtil * tau[j]);
if(explosion[j,k] == 0) {
n_succ += pumps[j,k];
}
n_pump += pumps[j,k];
}
}
}
```