如何在投资组合分析包中指定无风险利率

时间:2019-06-23 14:48:54

标签: r r-portfolioanalytics

我不确定如何在投资组合分析中指定无风险利率。最佳风险投资组合的计算就好像无风险利率为零,并且在绘制有效边界时,它与最佳风险投资组合不相切。请查看图形和代码。

graph

#returns_xts contains annual returns of risky assets
funds <- colnames(returns_xts)
init_portf <- portfolio.spec(assets=funds)
fi_constr <- weight_sum_constraint(type="full_investment")

bo_constr <- box_constraint(type = "box", assets =init_portf$assets, min = 0, max = 1)

mv_constr <- list(fi_constr, bo_constr)

ret_obj <-return_objective(name="mean")

var_obj <- return_objective(name="var", risk_aversion=30)

mv_obj <- list(ret_obj, var_obj)

mv_opt <-optimize.portfolio(R=returns_xts, portfolio=init_portf, constraints=mv_constr, objectives=mv_obj, optimize_method="ROI", trace=TRUE)

#gives Objective Measure: mean 0.04226; StdDev 0.03165 
print (mv_opt)

#this gives the graph which was uploaded
chart.EfficientFrontier(mv_opt, match.col = "StdDev", n.portfolios=50, rf=0.0307, xlim=c(0,0.2), ylim=c(0.02,0.08))

0 个答案:

没有答案