# Algorithm to Construct Covariance matrices

I am involved in a project where i need to construct some examples using non-negative Multivariate Gaussian Random variables(log-normal random variables). Part of the computation requires calculating the covariance matrices. Since i do not have any data and i am plucking numbers out of the air i was hoping if some one would be kind to verify that the following algorithm is valid or not.

1. I assume a bunch of positive log values as standard deviations for my variables. Lets call these $$s =[\sigma_1,\cdots, \sigma_n]$$
2. I then compute $$s^2 = s^{T}s.$$
3. I assume a correlation matrix $\rho$, which are all non-negative and this matrix is symmetric.
4. Multiply $\rho$ with $s^2$ element wise. This is a non standard operation, what i am suggesting here is the $(i, j)$th element of $s^2$ is multiplied by $(i, j)$th element of $\rho$. The matrix produced when all the element-wise operations are complete is the covariance matrix $\Sigma$.

I have verified in mat lab that $\Sigma$ values of my examples are Choleski decomposable, as in i get a valid upper triangle matrix as result. Hence i am inferring from that they are positive-definite. These matrices are also symmetric.

Can we infer based on the process and Choleski factorization, that covariance matrices are valid ?

https://math.stackexchange.com/q/250912/23874

(i) Where you have $s^\top s$ did you mean $ss^\top$?
If the answer is 'yes' to both item (i), you should get a covariance matrix corresponding to pairwise correlations of ρ $\rho_{ij}$ for all pairs.
Edit: it appears you meant $\rho_{ij}$ where you wrote $\rho$, so point (ii) is irrelevant. I have edited to reflect that.
• You should not use a single symbol, $\rho$ to represent different correlations. You need to use $\rho_{ij}$ or your explanation is actively misleading. No, you're not missing anything; you only need to be able to compute it right to the end without the diagonals getting 'small'. – Glen_b Dec 4 '12 at 22:44