Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sharpe

Sharpe Ratio


Description

This function computes the Sharpe ratio of the univariate time series (or vector) x.

Usage

sharpe(x, r = 0, scale = sqrt(250))

Arguments

x

a numeric vector or univariate time series corresponding to a portfolio's cumulated returns.

r

the risk free rate. Default corresponds to using portfolio returns not in excess of the riskless return.

scale

a scale factor. Default corresponds to an annualization when working with daily financial time series data.

Details

The Sharpe ratio is defined as a portfolio's mean return in excess of the riskless return divided by the portfolio's standard deviation. In finance the Sharpe Ratio represents a measure of the portfolio's risk-adjusted (excess) return.

Value

a double representing the Sharpe ratio.

Author(s)

A. Trapletti

See Also

Examples

data(EuStockMarkets)
dax <- log(EuStockMarkets[,"DAX"])
ftse <- log(EuStockMarkets[,"FTSE"])
sharpe(dax)
sharpe(ftse)

tseries

Time Series Analysis and Computational Finance

v0.10-48
GPL-2
Authors
Adrian Trapletti [aut], Kurt Hornik [aut, cre], Blake LeBaron [ctb] (BDS test code)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.