18
votes
4answers
5k views

What is the best way to “fix” a covariance matrix that is not positive semi-definite?

I have a sample covariance matrix of S&P 500 security returns where the smallest k-th eigenvalues are negative and quite small (reflecting noise and some high correlations in the matrix). I am ...
3
votes
2answers
720 views

Covariance for arbitrarily large portfolios

I am implementing a method in Java to calculate the variance, covariance, and value at risk for a portfolio, which should be flexible for use with any number of assets in a portfolio. I am struggling ...