I am running a Hurdle model that is integreated in a Hidden Markov Model. Indicated by Rhat, all model parameters converge quite good. However, the effective sample size of the individual-specific intercepts (alphai, alphaj) and the state-specific intercepts (mu, nu) decrease drastically if I add data of more individuals.
Unfortunately I cannot to share the full code, so I am posting the parts of the Stan model that might be relevant to answer this question:
data{
int<lower = 1> N; // number of observations
int<lower = 0> S; // number of states
int<lower = 1> H; // number of individuals
int<lower = 1> id[N]; // identifier of individuals
int<lower = 0> K1; // number of covariates inside delta in Bernoulli part
int<lower = 0> K2; // number of covariates inside delta in Lognormal part
matrix[N, K1] C1; // matrix of covariates for Bernoulli part
matrix[N, K2] C2; // matrix of covariates for Lognormal part
int<lower = 0, upper = 1> y[N]; // binary decision
real q[N]; // Hurdle: Dependent variable we want to model conditional on y
}
parameters {
ordered[S] mu; // state-dependent intercepts in Bernoulli part
vector[S] nu; // state-dependent intercepts in Lognormal part
real alphaj[H]; // individual-specific intercept in Bernoulli part
real alphai[H]; // individual-specific intercept in Lognormal part
real<lower = 0> sigma_alphai;
real<lower = 0> sigma_alphaj;
real<lower = 0> sigma_q;
vector[K1] delta1;
vector[K2] delta2;
}
model {
// priors
mu[1] ~ normal(0, 1)T[, mu[2]];
mu[2] ~ normal(0, 2);
nu[1] ~ normal(0, 1);
nu[2] ~ normal(0, 2);
alphai ~ normal(0, sigma_alphai);
alphaj ~ normal(0, sigma_alphaj);
...
for (t in 2:N) {
target += log_sum_exp(gamma);
for (k in 1:S){
gamma_prev[k] = bernoulli_logit_lpmf(y[t] | alphaj[id[t]] + mu[k] + C1[t]*delta1);
if(y[t] == 1){
gamma_prev[k] += lognormal_lpdf(q[t] | alphai[id[t]] + nu[k] + C2[t]*delta2, sigma_q);
...
This is the output for the individual-specific intercepts alphai and alphaj in case of 10 indivudals.
And this is the output using data of 200 individuals (first 10 alphai and alphaj):
What can I check to identify the cause of this issue? And, even more important, what can I do against it. Thanks in advance.