sortino: Sortino Ratio

Description Usage Arguments Value Examples

View source: R/sortino.R

Description

Calculates Sortino ratio from vector of gains or prices. The formula is: (mean(gains) - rf) / sd(gains[gains < 0]), where rf is some risk-free rate of return.

Usage

1
sortino(gains = NULL, prices = NULL, rf = 0)

Arguments

gains

Numeric matrix with 1 column of gains for each investment (can be a vector if there is only one).

prices

Numeric matrix with 1 column of prices for each investment (can be a vector if there is only one).

rf

Numeric value.

Value

Numeric value or vector.

Examples

1
2
3
4
5
6
# Simulate daily 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(stock.gains)

stocks documentation built on May 9, 2018, 1:05 a.m.

Related to sortino in stocks...