New answers tagged


I will just clarify Point 2 in StackG excellent answer. (It's really a comment, but it's too long and has too much math symbols to fit in the comment field.) Suppose you're given a covariance matrix $C$ for the returns of $n$ assets. (1000 $\times$ 1000 is 1 million entries - should not be too large for modern computers to work with, but do be mindful of ...


I would use Numpy (a library of Python) to do it. There's a function called numpy.random.multivariate_normal. It takes in 2 main arguments, an array of means (expected returns of the stocks) and an array (matrix) of covariances of the stocks.


What does 'simulate a covariance matrix' mean? If the question means, generate an arbitrary correlation matrix for 1000 stocks, then we can choose any symmetric matrix with all 1s down the diagonal, so long as every element is between -1 and 1 and the matrix is positive semi-definite. The large size of the matrix means that putting random values in every ...

Top 50 recent answers are included