I'd like to be able to create a matrix like the one below to be a correlation matrix. Trouble is, I cannot ensure it is positive definite, hence cannot use Cholesky factorisation, which I need to draw variates with this correlations structure.
I tried starting by generating eigen values and using a random orthogonal matrix to get a PD symmetric matrix, but then of course it does not look like this (values out the unit circle) and I would need some scaling, which seems cumbersome as well.
The matrix is randomly generated like this, so dont care what exactly the values are, just want to control proportion of negative values. I'm working in R and run out of ideas.
> cors
[,1] [,2] [,3] [,4] [,5]
[1,] 1.000 0.759 0.797 0.297 0.639
[2,] 0.759 1.000 0.539 -0.563 -0.773
[3,] 0.797 0.539 1.000 -0.354 0.291
[4,] 0.297 -0.563 -0.354 1.000 0.329
[5,] 0.639 -0.773 0.291 0.329 1.000
Many thanks!!!!
Let $A$ be the symmetric matrix given by $A = I + B$, where $B$ is symmetric and has zeroes on the main diagonal. If for all $j$ $$\sum_i |B_{ji}| \leq 1$$ then, by the Gerhgorin disc theorem, $A$ is semi positive definite and is a valid correlation matrix.
Thus, in order to correct given symmetric matrix $A$ to a correlation matrix one can simply rescale rows and columns of the $B$ matrix.
The other method is to find the Schur factorization of $A$, i.e. $A = UTU'$, where $U$ is orthogonal matrix and $T$ is diagonal matrix and take $\tilde{T} = \max(T,0)$. Then $\tilde{A} = U\tilde{T}U'$ is a valid covariance matrix, which can be rescaled to a valid correlation matrix.
The second procedure adds smaller perturbations to $A$, than the first method, but may change signs of some elements of resulting correlation matrix.