Bob,
Thank you so much!
All of these changes seem to both improve running time, and the model does run.
I think that now my question has to do with correctly parameterizing a draw of parameters when those parameters are essentially drawn from independent distributions. In this case, I have a hierarchical 2 PL IRT model, with a regression at levels two and three with factors that contribute to both alpha (or log gamma) ad beta, but I need to specify the residuals for those regressions of the fixed effects on alpha and beta as independent. I was attempting to specify a covariance matrix with 0's on the off-diagonals, but I frequently got warnings about the factorization of that covariance matrix being negative. For example, I attempted to specify a covariance matrix Sigma, and then draw from a multi normal distribution as follows:
transformed parameters {
cov_matrix[2] Sigmap[P];
Sigmap[p,1,1]<-taup[p,1];
Sigmap[p,1,2]<-nocov;
Sigmap[p,2,1]<-nocov;
Sigmap[p,2,2]<-taup[p,2];
}
and then in the model block I had:
mup[p] ~ multi_normal(mum[p] + if_else(X1[p], kc1, 0) + if_else(X2[p], kc2, 0), taup);
}
I read several posts about restricting tau to be less than 1, and this fixed the covariance matrix warnings, but I wondered if it wasn't causing other problems, namely it was inappropriately bounding tau, causing problems elsewhere... So then I attempted the following in this example, and the chains are not converging for taup. You'll see your suggested changes in the code implemented below! (I am sure it could be more elegant... :)
mup[p,1] ~ normal(mum[p,1] + if_else(X1[p], kc1[1], 0) + if_else(X2[p], kc2[1], 0), taup[1]);
mup[p,2] ~ normal(mum[p,2] + if_else(X1[p], kc1[1], 0) + if_else(X2[p], kc2[2], 0), taup[2]);
}
Should I return to bounding tau between 0 and 1, and returning to the multi_normal draw?
Again, I greatly appreciate your help!
Best,
Shauna