Portfolio Optimization constraints Matrix/bvec explanation

前端 未结 1 569
不知归路
不知归路 2021-01-16 07:43

I recently got very interested in portfolio optimization and started playing around in R, to create a minimum variance portfolio,

library(quadprog)
Dmat <         


        
相关标签:
1条回答
  • 2021-01-16 08:13

    First step is to write down the mathematical model. That could look like:

    The next part is to implement this in R's quadprog. That could look like:

    • Adding comments to the code may help to understand it later
    • Quadprog does not allow simple lower- and upper-bounds on the variables, so we need to convert these to >= inequalities.
    • Notice that Quadprog minimizes 0.5*x'Qx. That has the same result as minimizing x'Qx.
    • Shorting can be allowed by using other lower-bounds on x.
    • Your data makes the model infeasible. I loosened the upper-bound on allocations from 0.5 to 0.8.
    0 讨论(0)
提交回复
热议问题