[R-SIG-Finance] Change Expected Return in fPortfolio

Am Gut agquantr at gmail.com
Thu Jan 5 18:19:14 CET 2017


Hi everyone,

I am wondering if anyone can provide any guidance on how to change the
expected return when optimizing a portfolio using the fPortfolio package in
R. I do not have any code because I have been using the existing
methodology which uses the historical mean return. I am looking to pass an
expected return vector to use in the optimization or atleast change some of
the numbers in the statistics slot.

After reading in my data, I am running this:

ASFSpec = portfolioSpec()
print(ASFSpec)
constraints = "LongOnly"
#Minimum Risk Efficient Portfolio
minriskSpec = portfolioSpec()
targetReturn = getTargetReturn


#existing Portfolio

#Mean-Variance Tangency Portfolio
tgSpec = portfolioSpec()
setRiskFreeRate(tgSpec) = 0
tgPortfolio = tangencyPortfolio(data=ASFts,spec=tgSpec,constraints =
"LongOnly")
print(tgPortfolio)

This outputs:

Title:
 MV Tangency Portfolio
 Estimator:         covEstimator
 Solver:            solveRquadprog
 Optimize:          minRisk
 Constraints:       LongOnly

Portfolio Weights:
    HY    CDX    GBD
0.3835 0.0371 0.5794

Covariance Risk Budgets:
    HY    CDX    GBD
0.0899 0.0024 0.9077

Target Returns and Risks:
  mean    Cov   CVaR    VaR
0.0541 0.3981 0.8580 0.6087


Now I want to change the statistics slot for the initial return of CDX to
say 0.02. I write:

tgPortfolio at data@statistics$mean[2] = 0.02
tgPortfolio = tangencyPortfolio(data=ASFts,spec=tgSpec,constraints =
"LongOnly")
print(tgPortfolio)

Still get the same ouput. I understand why it is not working, but have no
idea on a workaround. Can someone advise me on how to feed in my own mean
returns?

Thanks,

AG

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list