Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. 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 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 performing some operations on the covariance matrix and this matrix must be positive definite. What is the best way to "fix" the covariance matrix? (For what it's worth, I intend to take the inverse of the covariance matrix.)

One approach proposed by Rebonato (1999) is to decompose the covariance matrix into its eigenvectors and eigenvalues, set the negative eigenvalues to 0 or (0+epsilon), and then rebuild the covariance matrix. The issue I have with this method is that i) the trace of the original matrix is not preserved, and ii) the method ignores the idea of level repulsion in random matrices (i.e. that eigenvalues are not close to each other).

Higham (2001) uses an optimization procedure to find the nearest correlation matrix that is positive semi-definite. Grubisic and Pietersz (2003) have a geometric method they claim outperforms the Higham technique. Incidentally, some more recent twists on Rebonato's paper are Kercheval (2009) and Rapisardo (2006) who build off of Rebonato with a geometric approach.

A critical point is that the resulting matrix not be singular (which can be the case when using optimization methods).

What is the best way to transform a covariance matrix into a positive definite covariance matrix?

UPDATE: Perhaps another angle of attack is to test whether a security is linearly dependent on a combination of securities and removing the offender.

share|improve this question
Since negative eigenvalues imply imaginary variances, do you really require the trace to be preserved? In a financial setting, I have yet to encounter a scenario where the difference between the truly Frobenius-norm nearest positive semi-definite matrix and one generated from spectral truncation was large enough to warrant the additional effort. – michaelv2 Oct 2 '11 at 12:10
up vote 10 down vote accepted

Nick Higham happens to have given a talk on this very subject this summer; he continues to actively work to improve nearest correlation matrix algorithms. You can see his talk and notes here: http://mxm.mxmfb.com/rsps/ct/c/629/r/90368/l/48110

share|improve this answer
Thanks - I will check it out! – Ram Ahluwalia Oct 2 '11 at 15:41
Great find. Higham's talk is based on a recent paper, Computing a Nearest Correlation Matrix with Factor Structure. This fact is a bit difficult to find within the talk, which covers a lot of other areas, too. – Tal Fishman Oct 3 '11 at 21:12
The link appears to be dead. – Mack Nov 29 '15 at 22:19

The short answer is that I don't know, but your question gives some hints about how to find out. The key thing for me is that you want a minimum variance portfolio. I don't think you should be thinking about some abstract mathematical operation that is "best", but rather look over a few mathematical operations and see which seems to work best for your application.

If you can approximate the problem you have now with data in the past, then you can test different methods over time.

Some observations:

  • if you have a long-only portfolio, then that already helps you out a lot.

  • If you have lots of assets relative to time points, then it is harder: you want to use (if possible) Ledoit-Wolf shrinkage or a factor model to estimate the variance matrix.

  • You don't want the optimizer to see any portfolios that have zero (or negative) risk. That is the finance version of positive eigenvalues -- you want your epsilon to be non-trivial.

  • You don't say why you start out with a non-positive definite matrix. If it is because of missing values and you have the original returns, then there is code to do Ledoit-Wolf shrinkage in such a case.

share|improve this answer
I am actually testing which random-matrix theory cleansing methods and covariance shrinkage methods (constant correlation, etc.) produce the most stable covariance matrix (as measured by the out-of-sample performance of the minVar portfolio). The way I am doing this is by finding the weights of the cleansed/shrunk matrix corresponding to a minimum variance portfolio, and then measuring the variance of this portfolio out-of-sample. – Ram Ahluwalia Oct 1 '11 at 17:06
FYI - I updated the question and dropped the reference to minimum variance and focused on inversion of the matrix itself – Ram Ahluwalia Oct 1 '11 at 20:39
Also, I updated the source of the covariance matrix. The negative eigenvalues result from the sample covariance matrix itself. I provided an upvote particularly because of the insight of your 3rd bullet point – Ram Ahluwalia Oct 1 '11 at 20:41

In Oracle Crystal Ball, we use an old algorithm, that works pretty well and converges fast. It is from Iman-Conovar. Here is the reference:

Iman, R.L., Conover, W.J. 1982. A distribution-free approach to inducing rank correlation among input variables. Commun. Statist.-Simula. Computa. 11, 311-334.

That said, Prof. Higham's method based on optimization works pretty good as well. He seems to have updated methods by Lurie and Goldberg, available at this link.

share|improve this answer
Thank you - this is helpful – Ram Ahluwalia Oct 4 '11 at 18:47

Here it is: "Rebonato, R., Jackel, P. The most general methodology to create a valid correlation matrix for risk management and option pricing purposes."

Recall: a covariance matrix will be the same as a correlation matrix if scale is removed. I used this method for ensuring positive definite correlations matrices.

share|improve this answer

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.