Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to use the mvnrnd function in matlab to generate random monthly returns for a set of assets. However, I am a bit confused about how to use this function to do it since it asks me MU and SIGMA values. How should I pick these values ?

share|cite|improve this question
Parameters of multinormal distribution $\mu$ and $\Sigma$ related to expectation and covariance matrix of the multinormal random vector. Specifically $\mathsf{E}(X_i) = \mu_i$ and $\mathsf{Cov}(X_i,X_j) = \Sigma_{i,j}$. You would choose these parameters depending on the problem you are solving – Sasha Feb 22 '12 at 13:25
What do you mean by negative values? The mean is negative, i.e. you have negative returns? Please provide more details. – user13655 Feb 22 '12 at 17:57
After I get the random values and average them I use portopt to find optimal weights for a range of expected returns. When using portopt, if I specify the expected returns I want in a vector using rMin + i * ( (rMax - rMin) / 9 ) where i<=0<=9, from time to time I get something like: "One or more requested returns are less than the return -0.003414 of the least risky portfolio." However, if dont specify anything there is no error. I thought its because of the negative returns from mvnrnd but then couldn't really figure out why.. – Cemre Feb 22 '12 at 18:25
up vote 1 down vote accepted

MU and SIGMA are usually estimated from historical data. For example, you can take time series of returns on your asset and compute their sample means (which will be stacked in your MU vector) and their sample covariance matrix (your SIGMA matrix). If the returns to K assets observed over T periods are stored in a KxT matrix R, then the MATLAB commands are:



share|cite|improve this answer
I think I understand now but I get negative values when I do like this (which later becomes a problem when I try to find optimal portfolios based on these values) – Cemre Feb 22 '12 at 13:52
Well, yes. If a security has declined in price over the period you're looking at, you would expect to see negative values for $\mu$. Why is this a problem when finding optimal portfolios? – Chris Taylor Feb 22 '12 at 18:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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