I’m modeling a hierarchical regression model over multiple time series demonstrations. Everything seems to go well until the end where I get warnings regarding the LKJ prior and a recommendation to reparameterize. Any suggestion on what kind of parameterization is needed, would be much appreciated.
data {
int<lower=1> N; // num demos
int<lower=1> T; // traj length
int<lower=1> K; // num basis
row_vector[T] y[N]; // traj data
matrix[K, T] psi; // basis feat
real eps;
}
parameters {
row_vector[K] mu;
cholesky_factor_corr[K] Lcorr;
row_vector<lower=0>[K] sigma;
row_vector[K] weights[N];
}
model {
mu ~ normal(0, 10);
sigma ~ cauchy(0, 10);
Lcorr ~ lkj_corr_cholesky(1);
for (n in 1:N) {
weights[n, :] ~ multi_normal_cholesky(mu, diag_pre_multiply(sigma, Lcorr));
for (t in 1:T) {
y[n, t] ~ normal(weights[n, :] * psi[:, t], sqrt(eps));
}
}
}
generated quantities {
matrix[K, K] omega;
matrix[K, K] cov;
omega = multiply_lower_tri_self_transpose(Lcorr);
cov = quad_form_diag(omega, sigma);
}
WARNING:pystan:Rhat for parameter Lcorr[1,1] is nan!
WARNING:pystan:Rhat for parameter Lcorr[1,2] is nan!
WARNING:pystan:Rhat for parameter Lcorr[1,3] is nan!
WARNING:pystan:Rhat for parameter Lcorr[2,3] is nan!
WARNING:pystan:Rhat for parameter Lcorr[1,4] is nan!
WARNING:pystan:Rhat for parameter Lcorr[2,4] is nan!
WARNING:pystan:Rhat for parameter Lcorr[3,4] is nan!
WARNING:pystan:Rhat for parameter Lcorr[1,5] is nan!
WARNING:pystan:Rhat for parameter Lcorr[2,5] is nan!
WARNING:pystan:Rhat for parameter Lcorr[3,5] is nan!
WARNING:pystan:Rhat for parameter Lcorr[4,5] is nan!
WARNING:pystan:Rhat for parameter Lcorr[1,6] is nan!
WARNING:pystan:Rhat for parameter Lcorr[2,6] is nan!
WARNING:pystan:Rhat for parameter Lcorr[3,6] is nan!
WARNING:pystan:Rhat for parameter Lcorr[4,6] is nan!
WARNING:pystan:Rhat for parameter Lcorr[5,6] is nan!
WARNING:pystan:Rhat for parameter omega[1,1] is nan!
WARNING:pystan:Rhat above 1.1 or below 0.9 indicates that the chains very likely have not mixed
WARNING:pystan:1252 of 10000 iterations ended with a divergence (12.52%).
WARNING:pystan:Try running with adapt_delta larger than 0.8 to remove the divergences.
WARNING:pystan:Chain 3: E-BFMI = 0.19194318452632705
WARNING:pystan:E-BFMI below 0.2 indicates you may need to reparameterize your model