Thanks to those who have answered my previous questions, it is great that there is an active and helpful community for Stan.

Today I have potentially what might be a bug with `cholesky_factor_corr`

. Basically when the size of the correlation matrix gets large, e.g. 40 x 40, I run into issues with the initial values for Cholesky factor correlation parameters:

```
Rejecting initial value:
Error evaluating the log probability at the initial value.
Exception: multi_normal_lpdf: LDLT_Factor of covariance parameter is not positive definite. last conditional variance is 6.66134e-015. (in 'model3d5066d27a9a_0b961540b66c542856a20ec83237a5e1' at line 18)
```

I have a simple example in R below:

```
stan.code <- "
data {
int K;
int R;
vector[K] draws[R];
vector[K] sigma;
vector[K] mu_0;
}
parameters {
cholesky_factor_corr[K] L_omega;
}
transformed parameters {
matrix[K, K] Sigma;
Sigma = quad_form_diag(tcrossprod(L_omega), sigma);
}
model {
draws ~ multi_normal(mu_0, Sigma);
}
"
n.draws <- 200
n.variables <- 40
draws <- matrix(rnorm(n.variables * n.draws),
nrow = n.draws,
ncol = n.variables)
stan.data <- list(
K = n.variables,
R = n.draws,
draws = draws,
sigma = rep(1, n.variables),
mu_0 = rep(0, n.variables)
)
fit <- stan(model_code = stan.code,
data = stan.data,
iter = 100,
chains = 1)
```

If `n.variables`

is reduced to 20 or I set `init = 0`

then everything works fine, so it appears to be an issue with initialization of the Cholesky factor correlation parameter when the matrix is large. Right now my solution is to pass in an identity matrix as the initial value. Has anyone reported this before?