# Matlab multivariate normal distribution parameters (mvnrnd)

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 ?

-
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

## 1 Answer

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:

MU=mean(R)

SIGMA=var(R)

-
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