I am trying to estimate the weights of an equal risk portfolio using the PortfolioAnalytics package in r.
To start with, I have tried to redo the example provided in the portfolio vignette. The code is given below,
[![library(PortfolioAnalytics)
library(DEoptim)
library(ROI)
require(ROI.plugin.glpk)
require(ROI.plugin.quadprog)
data(edhec)
R <- edhec\[, 1:6\]
colnames(R) <- c("CA", "CTAG", "DS", "EM", "EQMN", "ED")
funds <- colnames(R)
# Create an initial portfolio object with leverage and box constraints
init <- portfolio.spec(assets=funds)
init <- add.constraint(portfolio=init, type="leverage",
min_sum=0.99, max_sum=1.01)
init <- add.constraint(portfolio=init, type="box", min=0.05, max=0.65)
init$constraints\[\[2\]\]$min <- rep(0, 6)
init$constraints\[\[2\]\]$max <- rep(1, 6)
eq_meanETL <- add.objective(portfolio=init, type="return", name="mean")
eq_meanETL <- add.objective(portfolio=eq_meanETL, type="risk", name="ETL",
arguments=list(p=0.95))
eq_meanETL <- add.objective(portfolio=eq_meanETL, type="risk_budget",
name="ETL", min_concentration=TRUE,
arguments=list(p=0.95))
opt_eq_meanETL <- optimize.portfolio(R=R, portfolio=eq_meanETL,
optimize_method="DEoptim",
search_size=2000,
trace=TRUE, traceDE=5)][1]][1]
The risk contribution is given in the image.
My question is why is there a difference in the % risk contribution for all the portfolios. isn't the ERC portfolio produces the same contribution for each of the assets in the portfolio.
Thanks.