[R-SIG-Finance] Failure of solve.QP in portfolio modeling

aschmid1 aschmid1 at stevens.edu
Tue Sep 22 15:37:12 CEST 2015

Hi everyone,
I'm trying to estimate optimal Markowitz portfolio weights for a list of 
stocks chosen upon some criterion using solve.QP from quadprog library. 
When the number of stocks N reaches some limit, I get a message "matrix 
D in quadratic function is not positive definite." For example, if I 
rebalance every 6 weeks (which implies that variance is calculated for 
6-week interval prior to the period for which I calculate portfolio 
weights), I can get solution for 25>=N<50. For 12-week interval, 
solution exists for 50>=N<100, and for 24-week interval, I can get 
solution for N=100. My attempt to remedy this problem with Higham's 
method doesn't help. I'll greatly appreciate you input: first, why this 
may happen (can there be lack of local minimum?), and second, whether 
there are R solvers that may need only semi positive definite matrix.

Thanks! Alec

More information about the R-SIG-Finance mailing list