[R-SIG-Finance] quadprog error?
none
investorcurious at gmail.com
Fri Mar 16 17:12:20 CET 2012
Enrico, thank you very much for a prompt reply.
I have contacted Berwin A. Turlach a week ago. I will follow your
suggestion and will post this question to the r-help.
Regarding (3), my only concern is that this problem worked in the older
version of quadprog, so I was surprised to stumble on this error.
Enrico Schumann wrote:
>
> 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.
>
More information about the R-SIG-Finance
mailing list