Hi,
Looking at doing quadratic programming with the optimization tool but this is a first attempt and I am not sure what to enter through the Q input.
Does anyone have a working workflow so I can see the input being used here (the help section seems a bit light after the linear programming bit) .
Thanks!
Mikey
Solved! Go to Solution.
Hi @Mikey1,
I'm attaching a sample workflow with a configuration using a Quadratic Input. Hope this helps!
------------------------------------------------
Christine B
Customer Support Engineer
I'm curious why the Pearson Correlation tool is not / cannot be used for the covariance input here? It appears that the R matrix produces a different matrix than the embedded tool...
Trying to make this into a dynamic WF that can respond to any varied portfolio asset size...
thanks!
FYI - if anyone stumbles upon this and is like why doesn't the covariance match - two reasons:
1) Inside the R Tool there is language re:
# Set "risk aversion parameter", a = 8
a <- 8
cov_mat <- as.data.frame(-2*a*cov(dat))
2) the values are rotated/cross-tabbed. once you multiply by -16 and rotate the values match the Pearson tool.
two other issues - I think the workflow as posted is dense matrix variables in rows - not dense matrix constraints in rows as it initially showed up on my system.... Don't know if that's a change from the 2017 version. also I'm getting negative portfolio allocations. Albeit tiny negative allocations- they are still negative allocations which is odd as the lb is zero. I'd love to see a more up to date version of quadprog optimization if anyone has one.
Would you have an explanation please about why the quadratic portion of the objective function is provided by calculating a covariance matrix multiplied by -2*a? Thank you!
@mouna_belaid- I'd recommend digging into the R to see what's going on - but my assumption is that this relates to multiplying both sides by -2a to allow x = -b+/-(4ac)^.5 ?
Thank you @apathetichell for your reactivity.
Where x = -b+/-(4ac)^.5 that you mentioned comes from?
Left out the b^2 - but otherwise - just the standard quadratic equation has a 2a denominator which I'd expect this relates to. I'd have to dig more into it to get how this is implemented here. I honestly haven't look at this (or anything related to this in a while so I'd need a refresher).
Thank you for this clarification and for your reactivity.
What is the purpose of the R tool in the workflow ?