Documentation ¶
Index ¶
- func MAD(x []float64) float64
- func Median(x []float64) float64
- func MovStdDev(x, weights []float64, k int, omitNaNs, trailing, fullWnd bool) []float64
- func Normalize(x, weights []float64) []float64
- func RollingWindow(x []float64, k int, omitNaNs, trailing, fullWnd bool) [][]float64
- func Volatility(x []float64, periodicity float64) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MAD ¶
MAD returns a median absolute deviation (MAD) product.
The MAD algorithm, a recognized statistical methodology, is a robust analog to a more commonly used outlier technique, which uses standard deviation from the mean. MAD uses deviation from the median, which is less susceptible to distortion caused by outlying values.
MAD is determined by calculating the deviation from the median as follows:
1. subtracting each charge in the distribution from the median charge to determine each respective deviation from the median;
2. the absolute values of the deviations from the median are arrayed in order from lowest to highest and the median of the absolute deviations is determined;
3. the median of the absolute deviations (from the median) is multiplied by the constant of 1.4826;
4. this product is defined as the MAD.
func Median ¶
Median returns the median by arraying the data for a given slice from lowest to highest and identifying the value at which half of the data are higher and half are lower
func MovStdDev ¶
MovStdDev returns moving standard deviation, a slice of local k-point standard deviation values, where each standard deviation is calculated over a sliding window of length k across neighboring elements of x. Set center to true for center moving standard deviation or to false for trailing moving standard deviation.
func Normalize ¶
Normalize is normalizing a set of scores x using the standard deviation. This normalization is known as Z-scores. With elementary algebraic manipulations, it can be shown that a set of Z-score has a mean equal of zero and a standard deviation of one. Therefore, Z-scores constitute an unit free measure which can be used to compare observations measured with different units.
func RollingWindow ¶
RollingWindow splits slice x into a sliding window of length k. The window size is automatically truncated at the endpoints when there are not enough elements to fill the window.
- trailing - if there are more windows than length of x, do not select center windows
- omitNaNs - omit NaN values
- fullWnd - discard any window that uses fewer elements than k
func Volatility ¶
Volatility calculates historical volatility as annualized standard deviation of logarithmic returns
Types ¶
This section is empty.