# c<1
# Assets with a diagonal covariance matrix
n <- 3e2 # number of realizations
p <- .5*n # number of assets
b <- rep(1/p,p)
gamma <- 1
x <- matrix(data = rnorm(n*p), nrow = p, ncol = n)
test <- new_MV_portfolio_weights_BDOPS21(x=x, gamma=gamma, b=b, beta=0.05)
summary(test)
# Assets with a non-diagonal covariance matrix
Mtrx <- RandCovMtrx(p=p)
x <- t(MASS::mvrnorm(n=n , mu=rep(0,p), Sigma=Mtrx))
test <- new_MV_portfolio_weights_BDOPS21(x=x, gamma=gamma, b=b, beta=0.05)
str(test)
# c>1
n <-2e2 # number of realizations
p <-1.2*n # number of assets
b <-rep(1/p,p)
x <- matrix(data = rnorm(n*p), nrow = p, ncol = n)
test <- new_MV_portfolio_weights_BDOPS21_pgn(x=x, gamma=gamma,
b=b, beta=0.05)
summary(test)
# Assets with a non-diagonal covariance matrix
Run the code above in your browser using DataLab