library(Rsolnp)
data(MultiAsset)
Rets <- returnseries(MultiAsset, method = "discrete", trim = TRUE,
percentage = TRUE)
V <- cov(Rets)
## Budget Constraint
Budget <- function(x, Sigma) sum(x)
ERC <- PERC2(V, eqfun = Budget, eqB = 1)
ERC
w <- Weights(ERC) / 100
w * V
Run the code above in your browser using DataLab