Learn R Programming

PerformanceAnalytics (version 0.9.5)

TreynorRatio: calculate Treynor Ratio of excess return over CAPM beta

Description

The Treynor ratio is similar to the Sharpe Ratio, except it uses beta as the volatility measure (to divide the investment's excess return over the beta).

Usage

TreynorRatio(Ra, Rb, rf = 0, scale = 12, ...)

Arguments

Ra
a vector, matrix, data frame, timeSeries or zoo object of asset returns
Rb
return vector of the benchmark asset
rf
risk free rate, in same period as your returns
scale
number of periods in a year (daily scale = 252, monthly scale = 12, quarterly scale = 4)
...
any other passthru parameters

Value

  • Treynor ratio

Details

Equation: $$\frac{\overline{(R_{a}-R_{f})}}{\beta_{a,b}}$$

See Also

SharpeRatio SortinoRatio CAPM.beta

Examples

Run this code
# First we load the data
data(edhec)
edhec.length = dim(edhec)[1]
start = rownames(edhec[1,])
start
end = rownames(edhec[edhec.length,])
edhec.zoo = zoo(edhec, order.by = rownames(edhec))
rf.zoo = download.RiskFree(start = start, end = end)
sp500.zoo = download.SP500PriceReturns(start = "1996-12-31", end = end)

# Now we have to align it as "monthly" data
time(edhec.zoo) = as.yearmon(time(edhec.zoo))
time(sp500.zoo) = as.yearmon(time(sp500.zoo))
time(rf.zoo) = as.yearmon(time(rf.zoo))
data.zoo = merge(edhec.zoo[,9,drop=FALSE],sp500.zoo)
time(data.zoo) = as.Date(time(data.zoo),format="%b %Y")
time(rf.zoo) = as.Date(time(rf.zoo),format="%b %Y")

TreynorRatio(data.zoo[,1], data.zoo[,2], rf=rf.zoo)

Run the code above in your browser using DataLab