0
$\begingroup$

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. enter image description here

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.

$\endgroup$
  • $\begingroup$ (1) I don't know this package (2) you have box constraints on the portfolio weights. Are any of these constraint binding? What happens if you loosen these contraints, do the ERC contribs become equal? $\endgroup$ – noob2 Apr 12 '17 at 12:16
  • $\begingroup$ Box constraints are not binding here, also the box constraints are relaxed to long only in the code. $\endgroup$ – Sadhak Apr 12 '17 at 13:45
  • $\begingroup$ If your goal is to create an ERC portfolio, the FRAPO package might be much easier to use. I use it myself regularly. It works quite well. $\endgroup$ – pteetor Jun 20 '18 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.