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).


2 Answers 2


You can just take the diagonal of the var-cov matrix. This should give you the variance of each stock and then take sqrt of that for std. deviation.

sd = sqrt(diag(vcm))
  • $\begingroup$ thanks for your answer. I'm struggling with your solution because I would disregard the correlation between the assets... $\endgroup$
    – Clems
    Aug 9, 2014 at 9:27
  • $\begingroup$ Then it depends completely on the application of why are you doing this in the first place. I assumed you are looking at stocks individually. Can you elaborate what will you be using this for? Sometimes application derives what approach to use. $\endgroup$
    – Taran
    Aug 9, 2014 at 9:35

I think your approach based perhaps on The Complex Unit's forum post is correct. However, you may be making this more confusing for yourself with the notation and vocabulary.

The phrase volatility matrix is not really correct though I can see how someone might get there because the market price of risk formula looks like and is related to the Sharpe Ratio formula. A Cholesky Decomposition is mainly a tool for solving inverse matrix problems. In this case the inverse problem is what would the market price need to be to justify holding this return stream as mean-variance optimized portfolio.

Does that help clarify?

  • $\begingroup$ Also, you might want to write the inverse of vm instead of division by vm so it is clear that you need the inverse of a matrix (done via Cholesky Decomposition) rather than a single volatility value. $\endgroup$
    – rhaskett
    Nov 8, 2014 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.