In [R] one can pass either a vector or scalar as the risk free rate. What is better? If I pass a vector to (for example) chart.riskreturnscatter then the sharpe ratio lines disappear.


So is this a feature?

Thanks, Raghu


1 Answer 1


This is a feature, when you pass a vector it's because the risk free rate has changed over time. E.g. you can assume a constant or changing risk free rate as each period of returns can have an associated risk free rate.

  • $\begingroup$ Kyle - Thanks for the response. I appreciate why one would want a varying Rf but if I pass a vector I can't get the Sharpe lines on the graph. Do Sharpe line not make sense with a varying Rf rate? $\endgroup$ Jan 9, 2015 at 21:21
  • $\begingroup$ Try playing the graphical parameters to ensure your lines are not out of range of the graph. $\endgroup$ Jan 9, 2015 at 21:44
  • $\begingroup$ In chart.RiskReturnScatter, Sharpe lines are added using abline(a = (Rf * 12), b = add.sharpe[line], col = "gray", lty = 2) } (where b = c(1,2,3)) This won't work if Rf is a vector because a has to be a scalar. $\endgroup$ Jan 12, 2015 at 16:30
  • $\begingroup$ # @todo: Drawing Sharpe ratio lines currently throws warnings; change test statement, from the source code, likely it's a work in progress. $\endgroup$ Jan 16, 2015 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.