Session Ready
Exercise

The global minimum variance portfolio - End game

Even though the previous exercise provided a good insight in the calculation of a global minimum variance portfolio when short sales are not allowed, this way of working is somewhat complex.

One of the great things of R is that you can "hide" this complexity in a function and/or package. You provide the input to the function via its arguments, and R does the rest.

So instead of calculating the global minimum variance portfolio via the solve.QP() function, you can also use globalMin.portfolio() function.globalMin.portfolio() has an argument shorts and if you set this argument equal to FALSE, short sales are not allowed. In the background it is still solved as a quadratic programming problem, but as a user you are spared from these underlying details.

You can always check the underlying code of the function by typing globalMin.portfolio in the console.

Instructions
100 XP
  • Calculate the composition of the global minimum variance portfolio with no short sales allowed. This time using the globalMin.portfolio() instead of solve.QP() and the restriction matrices.