# How to calculate the volatility matrix with multiple stocks

calculating the volatility for a single stock is straightforward. However, I'm not sure whether my approach for calculating the volatility matrix for multiple stocks is correct:

I assume a log-normal distribution of the stock prices. Therefore I calculate the log returns, calculate the variance-covariance matrix of the log returns and perform the cholesky decomposition of the variance-covariance matrix. The result from the last step is, as far as I am aware of, the volatility matrix.

Let ln_sec be a m x n matrix with the log returns of n securities over a period of m months, then my matlab code is as follows:

vcm = cov(ln_sec) %var-cov matrix
vcm = vcm * 12 %annualize var-cov matrix
vm = chol(vcm) %volatility matrix


Would you agree on my approach?

Thank you.

Edit: I forgot to mention the application in order to discuss a suitable solution. The volatility matrix is used to calculate a market price of risk vector as follows

(drift - risk-free-rate*1)/vm


where drift is a n x 1 vector with the mean drift rates of n assets and 1 is a n x 1 vector with 1's. The market price of risk vector is then used to simulate a state-price density (pricing kernel).

-

sd = sqrt(diag(vcm))