sortino_ratio: Sortino Ratio

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Calculate Sortino ratio based on a vector of gains or prices. The formula is: (mean(gains) - rf) / sd(negatives(gains)). Here rf is some risk- free rate of return, gains is a vector of gains (usually daily, but could be any time interval), and negatives(gains) gets the subset of gains that are negative.

Usage

1
2
3
4
sortino.ratio(gains = NULL,
              prices = NULL,
              rf = 0,
              nas = FALSE)

Arguments

gains

Numeric vector of gains.

prices

Numeric vector of investment prices (typically daily closing prices).

rf

Risk-free rate of return hypothetically available to the investor.

nas

If TRUE, function finds and removes any missing values (NAs) in prices. The default is FALSE to maximize speed for the usual case where there are no missing values.

Value

Numeric value indicating the Sortino ratio.

Note

Several definitions of Sortino ratio are commonly used; this simple version may or may not be the one you prefer.

Author(s)

Dane R. Van Domelen

References

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

See Also

gains.rate, prices.rate, mdd, sharpe.ratio, rrr

Examples

1
2
3
4
5
6
# Randomly generate daily stock gains over a 5-year period
set.seed(123)
stock.gains <- rnorm(252 * 5, 0.0005, 0.01)

# Calculate Sortino ratio using risk-free return of 0
sortino.ratio(stock.gains)

stocks documentation built on May 2, 2019, 5:22 p.m.