[R-SIG-Finance] quadprog error?

Enrico Schumann enricoschumann at yahoo.de
Fri Mar 16 11:53:59 CET 2012


Hi <?>,

I did *not* check your code, but:

(1) when did you contact the package maintainer? Please keep in mind 
that maintaining a package is volunteer work; so you may want to grant 
the maintainer a few days to consider your message.

(2) Unless this is a very finance-specific problem, you may then want to 
post such a question on r-help (as the posting guide suggests).

(3) A pointer: IIRC, the algorithm in solve.QP requires a 
positive-definite matrix; but yours seems rank-deficient (or very badly 
conditioned).

Regards,
Enrico



Am 16.03.2012 01:44, schrieb none:
> I want to report a following error with quadprog. The solve.QP function
> finds a solution to the problem below that violates the last equality
> constraint. I tried to solve the same problem using ipop from kernlab
> package and get the solution in which all equality constraints are
> enforced. I also tried an old version of quadprog, Version: 1.4-11,
> Date: 2007-07-12 and my problem is solved correctly.
>
> I have tried to contact Berwin A. Turlach <Berwin.Turlach at gmail.com>
> (maintainer for quadprog package) with no success.
>
>
> ##############################################################
> load(file='quadprog.Rdata')
>
> # solve QP using quadprog
> require(quadprog)
> sol = solve.QP(Dmat, dvec, Amat, bvec, meq)
> x = sol$solution
> check = x %*% Amat - bvec
> # for some reason last equlity constraint is violated
> round(check[1:meq], 4)
>
> # solve QP using kernlab
> require(kernlab)
> n = nrow(Amat)
> sv = ipop(c = matrix(dvec), H = Dmat, A = t(Amat[,1:meq]),
> b = bvec[1:meq], l = rep(-1000, n), u = rep(1000, n), r = rep(0,meq))
>
> x = primal(sv)
> check = x %*% Amat - bvec
> # all constraints are ok
> round(check[1:meq], 4)
>
>
>
>
>
> _______________________________________________
> 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.

-- 
Enrico Schumann
Lucerne, Switzerland
http://nmof.net/



More information about the R-SIG-Finance mailing list