Hello, I need to draw the structural model from a trivariate normal distribution. I have three variables: y, x, z. I know that \sigma_z = 1. This is expressed by indicating scale_new[3] = 1. I also know that the correlation between the error of x and the error of z is 0, i.e., \rho_{23} = 0 . This is defined by cov_mat[2,3] = 0 and cov_mat[3, 2] = 0. The thing is now: I am getting divergent transitions, and most probably because my variance-covariance matrix is not positive definite. What kind of priors do i need to define separately for the correlations (i.e. \rho_{13} and \rho_{12}) in order to get positive-definite matrix? What goes wrong with beta priors for the correlations? I attach the code:

```
data {
int<lower=0> N;
int<lower=1> NX; // dimension of endogenous var//i.e. categories
vector[N] y; //outcome vector
vector[N] x; //endogenous variable
vector[N] z; // instrument
int sim_data;
}
transformed data {
vector[3] Y[N];
for(i in 1:N) {
Y[i][1] = y[i];
Y[i][2] = x[i];
Y[i][3] = z[i];
}
}
parameters {
ordered[NX] beta_x;
vector[2] beta_null;
real alpha_z;
vector<lower=0>[3] scale;
corr_matrix[3] Omega;
}
transformed parameters {
vector[3] mu[N];
matrix[3, 3] cov_mat;
vector[3] scale_new;
for(i in 1:N) {
mu[i][1] = beta_null[1] + x[i] * beta_x[NX];
mu[i][2] = beta_null[2] + z[i] * alpha_z;
mu[i][3] = 0;
}
cov_mat = Omega;
cov_mat[2, 3] = 0;
cov_mat[3, 2] = 0;
scale_new = scale;
scale_new[3] = 1;
}
model {
//priors
beta_x ~ normal(0,1);
beta_null[1] ~ normal(13,3);
beta_null[2] ~ normal(5,3);
alpha_z ~ normal(0,1);
scale_new[1] ~ inv_gamma(2,2);
scale_new[2] ~ inv_gamma(2,2);
cov_mat[1, 2] ~ beta(5, 5);
cov_mat[1, 3] ~ beta(2, 8);
cov_mat[2, 1] ~ beta(5, 5);
cov_mat[3, 1] ~ beta(2, 8);
if(sim_data==0) {
Y ~ multi_normal(mu, quad_form_diag(cov_mat, scale_new));
}
}
```