Portfolio Optimization constraints Matrix/bvec explanation

吃可爱长大的小学妹 提交于 2019-12-01 13:58:43

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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!