Hi all,
I am using the code below. This code was modified to use ver weak priors since I was having some issues of convergence before. However, this takes too long, since it has been running all night and it did reach 30% in Chain 1. Moreover, by using cmdstanr besides stan_model. Any ideas how can I improve on this? Is this normal that it takes so long?
Chain 1: Gradient evaluation took 0.022591 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 225.91 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
functions {
vector model3(real t, vector y, real pAB, real uAB, real uASC) {
vector[2] dydt;
dydt[1] = pAB*y[2]-uAB*y[1];
dydt[2] = -uASC*y[2];
return dydt;
}
}
data {
int <lower=1> nobs;
real t0;
vector[2] y0;
real ts[nobs];
int <lower=1> indivs;
real <lower=0> antib[nobs];
//real <lower=1, upper=indivs> subj[nobs];
}
parameters {
real <lower=0> pAB0;
real <lower=0> uAB;
real <lower=0> uASC0;
real <lower=0> sigma;
real <lower=0> sigmapAB;
real <lower=0> sigmauASC;
//real <lower=0> rpABmu;
//real <lower=0> ruASCmu;
real <lower=0> rpAB[indivs];
real <lower=0> ruASC[indivs];
}
model {
vector[2] yhat[nobs];
//prior distributions
pAB0 ~ normal(0.5, 0.5);
uASC0 ~ normal(0.5, 0.5);
//rpABmu ~ normal(0, 0.001);
uAB ~ normal(0, 0.001);
//ruASCmu ~ normal(0, 0.001);
sigmapAB ~ inv_gamma(0.01, 0.01);
sigmauASC ~ inv_gamma(0.01, 0.01);
sigma ~ inv_gamma(0.01, 0.01);
for (j in 1:indivs) {
real pAB = pAB0*rpAB[j];
real uABt = uAB;
real uASC = uASC0*ruASC[j];
yhat = ode_rk45(model3, y0, t0, ts, pAB, uABt, uASC);
//likelihood
for (i in 1:nobs) {
antib[i] ~ lognormal(yhat[i,2], sigma);
rpAB[j] ~ normal(0.01, sigmapAB);
ruASC[j] ~ normal(0.01, sigmauASC);
}
}
}
generated quantities {
real z_pred[nobs];
for (t in 1:nobs){
z_pred[t] = lognormal_rng(antib[t], sigma);
}
}