I recently got very interested in portfolio optimization and started playing around in R, to create a minimum variance portfolio,
library(quadprog)
Dmat <
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: