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

Patrick Burns patrick at burns-stat.com
Tue Sep 22 20:59:36 CEST 2015


You can use a factor model or shrinkage
to get a positive definite variance matrix.
There is a function for each in the
BurStFin package on CRAN.

The optimizer in Portfolio Probe doesn't
care about positive definiteness (though
that is not always a good thing).  It is
free for academic use.

Pat

On 22/09/2015 14:37, aschmid1 wrote:
> 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
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.

-- 
Patrick Burns
patrick at burns-stat.com
http://www.burns-stat.com
http://www.portfolioprobe.com/blog
twitter: @burnsstat @portfolioprobe



More information about the R-SIG-Finance mailing list