Values (matrix) randomly drawn for Cholesky factor of correlation matrix do not have strictly positive diagonal entries

I declared the Cholesky factor of a correlation matrix by:

cholesky_factor_corr[I] Cholesky_Omega;

In the transformed parameters block, I print it by using:

transformed parameters{

However, the outputs of the print command show that some the values randomly drawn for Cholesky factor of correlation matrix (Cholesky_Omega) are [[1,0],[1,0]], whose diagonal entries are not strictly positive. In this case, if [[1,0],[1,0]] is multiplied by its transpose, the outcome matrix(which should be the correlation matrix) is not positive definite. But correlation matrix must be positive definite.

My question is do I need to constrain some elements in the declaration of Cholesky factor of correlation matrix to ensure that the randomly drawn Cholesky factors have stricly positive diagonal entries?

Hope Stan developers can see this and give advisable suggestions.

If X is of the variable type cholesky_factor_corr, it is constrained such that multiply_lower_tri_self_transpose(X) is positive definite. I’m not sure that X itself should be expected to be positive definite, but I’m not super familiar with cholesky factors of correlation matrices.

Sorry, I double checked the properties of Cholesky factor and found that it is not required to be positive definite. But it is required that its diagonal entries must be strictly positive so that the corresponding correlation matrix is positive definite.

Can you give a bit more context as to when you’re encountering errors resulting from the correlation matrix implied by the cholesky_factor_corr variable not being positive definite? If in the initial stages of warmup, that’s common (caused by numeric instabilities) and can be ignored if they don’t outright cause warmup to halt.

1 Like

Yeah, it indeed happened in initial stages of warmups.