p <- 150
n <- 300
gamma <- 10
mu <- seq(0.2,-0.2, length.out=p)
Sigma <- RandCovMtrx(p=p)
x <- t(MASS::mvrnorm(n=n , mu=mu, Sigma=Sigma))
EW_port <- rep(1/p, length=p)
MV_shr_port <- new_MV_portfolio_weights_BDOPS21(x=x, gamma=gamma,
b=EW_port, beta=0.05)$weights
GMV_shr_port <- new_MV_portfolio_weights_BDOPS21(x=x, gamma=Inf, b=EW_port,
beta=0.05)$weights
MV_trad_port <- new_MV_portfolio_traditional(x=x, gamma=gamma)$weights
GMV_trad_port <- new_MV_portfolio_traditional(x=x, gamma=Inf)$weights
weights.eff <- cbind(EW_port, MV_shr_port, GMV_shr_port,
MV_trad_port, GMV_trad_port)
colnames(weights.eff) <- c("EW", "MV_shr", "GMV_shr", "MV_trad", "GMV_trad")
Fplot <- plot_frontier(x, weights.eff)
Fplot
Run the code above in your browser using DataLab