Part of my code is as follows
`parameters{
corr_matrix[2] omega; //Correlation matrix
matrix[n_p,2] person_offset; //
}
transformed parameters{
vector[n_p] theta;
vector[n_p] tau;
vector<lower=0>[2] std; //standard deviation of theta and tau
std[1]=1; //I want to fix the standard deviation of theta to be 1
matrix[n_p,2] person_parameters;
for (n in 1:n_p) {
person_parameters[n,] = person_offset[n,] * quad_form_diag(omega, std);
}
theta[1:n_p] = person_parameters[1:n_p,1];
tau[1:n_p] = person_parameters[1:n_p,2]; //theta and tau obey the multivariate normal distribution
}
model{
omega ~ lkj_corr(1);
std[2] ~ normal(0, 2.5);
for(n in 1:n_p){
person_offset[n,] ~ normal(0,1);
}
}`
When I run all of my code, I will encounter the following problems:
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: validate transformed params: std[2] is nan, but must be greater than or equal to 0 (in âmodel304c3c6a54c6_seq12â at line 82)
Does anyone know how to solve itďź