Last data update: 2014.03.03

Data Source

R Release (3.2.3)
CranContrib
BioConductor
All

Data Type

Packages
Functions
Images
Data set

Classification

Results 1 - 10 of 20 found.
[1] < 1 2 > [2]  Sort:

final.balance (Package: stocks) :

Calculated as: initial * prod(ratios)
● Data Source: CranContrib
● Keywords:
● Alias: final.balance
● 0 images

pdiffs (Package: stocks) :

Calculates proportion/percent differences between subsequent (or lagged) elements of a numeric vector.
● Data Source: CranContrib
● Keywords:
● Alias: pdiffs
● 0 images

daily.yearly (Package: stocks) :

Converts a daily proportion gain to a corresponding annual (or several year) gain. For example, an investment that gains 0.1% per day would gain approximately 28.5% in a year (251 trading days). The formula is: total.gain = (1 + daily.gain)^(251 * years) - 1. Here total.gain and daily.gain are proportions (e.g. 0.15 for 15%).
● Data Source: CranContrib
● Keywords:
● Alias: daily.yearly
● 0 images

sortino (Package: stocks) :

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 weekly, monthly, or some other time interval), and negatives(gains) gets the subset of gains that are negative. User can specify prices or gains.
● Data Source: CranContrib
● Keywords:
● Alias: sortino
● 0 images

gains.rate (Package: stocks) :

The formula is simply: overall.rate = prod(gains + 1) - 1. If xday is specified, then it converts to x-day growth rate. For example, if balances is a vector of stock gains over a five-day period, say c(-0.02, -0.01, 0.01, 0.02, 0.01), then the total growth rate is approximately 0.0095 over five trading days. If xday.rate is set to 1, this rate is converted to an average daily rate of approximately 0.0019.
● Data Source: CranContrib
● Keywords:
● Alias: gains.rate
● 0 images

sharpe (Package: stocks) :

Calculate Sharpe ratio based on a vector of gains (or prices). The formula is: (mean(gains) - rf) / sd(gains). Here rf is some risk-free rate of return, and gains is a vector of gains (usually daily, but could be weekly, monthly, or some other time interval). User can specify prices or gains.
● Data Source: CranContrib
● Keywords:
● Alias: sharpe
● 0 images

positives (Package: stocks) :

Simply returns the positive (or non-negative) elements of some input vector x. Defined as x[which(x > 0)] or x[which(x >= 0)] depending on include.zero input.
● Data Source: CranContrib
● Keywords:
● Alias: positives
● 0 images

nonnegatives (Package: stocks) :

Simply returns the non-negative elements of some input vector x. Defined as x[which(x >= 0)].
● Data Source: CranContrib
● Keywords:
● Alias: nonnegatives
● 0 images

balances (Package: stocks) :

Calculates vector of balances based on initial balance and vector of ratios from one time point to the next (i.e. proportion gains + 1). This is a simple function containing this R code: initial * cumprod(ratios)
● Data Source: CranContrib
● Keywords:
● Alias: balances
● 0 images

diffs (Package: stocks) :

Calculates differences between subsequent (or lagged) elements of a numeric vector. Very similar to base function diff, but written in C++ to run faster.
● Data Source: CranContrib
● Keywords:
● Alias: diffs
● 0 images