Skip to content
Prev 7412 / 15274 Next

portfolio.optim and error in solve.QP: matrix D not positive definite

The problem could be due to few reasons the papers by Higham &  
Rebonato are a good read as to what the recipe does. The simplest  
recipe is to set the negative eigenvalues to a small positive number  
and rescale the matrix.

There are a few causes for this if you create corr matrices from  
bivariate estimation and slap them together that may not be PD. In  
some cases  in derivative pricing the matrix is hand glued together  
from implied correlations between two assets. Now a matrix of such  
implied corrs does not have to be PD and fails.

Sample corr matrices are by definition PD however often times if you  
have a lot of missing data(illiquid names in your universe?) and if  
you do a  na.locf (creating a const asset) this could do it as well.

It might be useful to do multivariate imputation with some o the R  
packages rather than deletion or carrying fwd on your data.

There are other reasons besides all of the above for your corr matrix  
being non PD. I think if you are working with such a large universe it  
might be easier to have factor corr matrices using PCA or ICA. This  
way if you manage to label the factors then you can see what bets your  
optimizer is taking.


HTH

Best
Krishna



On Jan 29, 2011, at 3:52 PM, "Lui ##" <lui.r.project at googlemail.com>  
wrote: