Monday 15 August 2011

r - Adding weights to SharpeRatio in PerformanceAnalytics -



r - Adding weights to SharpeRatio in PerformanceAnalytics -

using illustration performanceanalytics.pdf of

sharperatio(edhec, rf = 0, fun="var" , method="modified") homecoming per unit of (var) risk based on (i assume) equal weighted portfolio assumption, when seek add together weights:

weights <- rep(1/13,13) sharperatio(edhec, rf = 0, fun="var" , method="modified", portfolio_method="component",weights = weights)

i errors :

"error in match.fun(funct)(r, rf = rf, p = p, weights = weights, portfolio_method = "single", : formal argument "portfolio_method" matched multiple actual arguments"

does know how (form) expand sharperatio function incorporate portfolio weights?

it appear sharperatio has difficulty creating portfolio given components , weights. solution give sharperatio weighted portfolio. if portfolio weighted combination of components @ each time point( appears sharperatio calculate), use

rf <- 0 sharperatio((zoo(edhec) -rf) %*% weights, fun="var", method="modified")

where edhec first converted zoo time series allow weights calculation. portfolios perhaps more realistic time dependence, first calculate portfolio with, example, quarterly rebalancing, , utilize sharperatio

port <- return.portfolio(edhec, weights, rebalance_on = "quarters") sharperatio(port, rf=rf, fun = "var", method="modified")

r performanceanalytics

No comments:

Post a Comment