Statistic functions (TA-Lib group).
Linear regression fits y = intercept + slope * x over each lookback
window with x = 0..period - 1. linear_reg/2 is the fitted value at
the window's last point, tsf/2 projects one bar ahead, angle/2 is
the slope in degrees. beta/3 and correl/3 relate two series over
the window. See TAlib for the conventions: chronological input,
series aligned with the input, nil for insufficient data.
Summary
Functions
The regression slope in degrees (TA-Lib LINEARREG_ANGLE).
Beta of prices against market over the period newest points:
covariance / market variance.
Pearson correlation of the two series over the period newest points.
The intercept of the linear regression over the period newest prices
(TA-Lib LINEARREG_INTERCEPT).
The fitted value of the linear regression at the window's last point (TA-Lib LINEARREG).
The slope of the linear regression over the period newest prices
(TA-Lib LINEARREG_SLOPE).
The Time Series Forecast: the regression projected one bar past the window's last point (TA-Lib TSF).
The population Variance of the period newest prices.
Functions
@spec angle([number()], pos_integer()) :: float() | nil
The regression slope in degrees (TA-Lib LINEARREG_ANGLE).
iex> TAlib.Indicators.Stats.angle([1, 2, 3, 4, 5], 3)
45.0
@spec beta([number()], [number()], pos_integer()) :: float() | nil
Beta of prices against market over the period newest points:
covariance / market variance.
iex> TAlib.Indicators.Stats.beta([1, 2, 3, 4], [2, 4, 6, 8], 3)
2.0
@spec correl([number()], [number()], pos_integer()) :: float() | nil
Pearson correlation of the two series over the period newest points.
iex> TAlib.Indicators.Stats.correl([1, 2, 3, 4], [2, 4, 6, 8], 3)
1.0
@spec intercept([number()], pos_integer()) :: float() | nil
The intercept of the linear regression over the period newest prices
(TA-Lib LINEARREG_INTERCEPT).
iex> TAlib.Indicators.Stats.intercept([1, 2, 3, 4, 5], 3)
3.0
@spec linear_reg([number()], pos_integer()) :: float() | nil
The fitted value of the linear regression at the window's last point (TA-Lib LINEARREG).
iex> TAlib.Indicators.Stats.linear_reg([1, 2, 3, 4, 5], 3)
5.0
@spec slope([number()], pos_integer()) :: float() | nil
The slope of the linear regression over the period newest prices
(TA-Lib LINEARREG_SLOPE).
iex> TAlib.Indicators.Stats.slope([1, 2, 3, 4, 5], 3)
1.0
@spec tsf([number()], pos_integer()) :: float() | nil
The Time Series Forecast: the regression projected one bar past the window's last point (TA-Lib TSF).
iex> TAlib.Indicators.Stats.tsf([1, 2, 3, 4, 5], 3)
6.0
@spec variance([number()], pos_integer()) :: float() | nil
The population Variance of the period newest prices.
iex> TAlib.Indicators.Stats.variance([1, 2, 3, 4], 2)
0.25