hi all, I am using stan to build a Bayesian hierarchical model where individual-level parameters are a function of their individual-characteristics. The structure of my model is similar to the following descriptions. I am trying to use cholesky_factor_corr() to reparameterize it. My question is, how should I put constraints to avoid my individual-level parameters gamma_i to have extremely big/small values? I have already put lower bounds for the scale e.g., lambda_raw, etc., however, it still produces values as small as -10^100. Should I change priors ?
data{ //with reparameterization.
//other irrelevant part...
matrix[ncust,nchar] Demo;
}
transformed data {
matrix[nchar+1,ncust] Demo_tran;
row_vector[ncust] ones = rep_row_vector(1,ncust);
Demo_tran = append_row(ones,transpose(Demo));
}
parameters{
vector<lower=-1,upper=1>[3*(nchar+1)] lambda_raw;
vector<lower=0,upper=1>[3*(nchar+1)] sigma_lambda;
cholesky_factor_corr[3*(nchar+1)] L_lambda;
matrix<lower=-1,upper=1>[3,ncust] gamma_raw;
vector<lower=0,upper=3>[3] tau_gamma;
cholesky_factor_corr[3] L_gamma;
//...other irrelevant part
}
transformed parameters {
vector[3*(nchar+1)] lambda_vec;
lambda_vec = sigma_lambda.*(L_lambda*lambda_raw);
matrix[3,nchar+1] Lambda_mat;
Lambda_mat = to_matrix(lambda_vec,3,nchar+1);
matrix[3,3] L_V_gamma = diag_pre_multiply(tau_gamma,L_gamma);
matrix[3,ncust] mu_gamma;
mu_gamma = Lambda_mat * Demo_tran;
matrix<lower=-700,upper=50>[3,ncust] Gamma = mu_gamma + L_V_gamma*gamma_raw;
//.... other irrelevant part
}
model{
lambda_raw ~ std_normal();
sigma_lambda ~ cauchy(0,5);
L_lambda ~ lkj_corr_cholesky(2);
tau_gamma ~ cauchy(0,2.5);
L_gamma ~ lkj_corr_cholesky(2);
to_vector(gamma_raw) ~ std_normal();
///....
}
}