# Statistic Functions

## Linear Regression

Definition: Calculates the linear regression for the input time series.
Syntax: `linearreg(period)`
Arguments: `period` - the length of period to use in the calculation
Return: A time series of values representing the linear regression for the input time series.
Description: The linear regression is a trend-following indicator that uses a least squares regression line to fit the input time series. It is calculated using the high, low, and close values of the input time series.
Example:
linear_reg_values = ETH.close -> linearreg(15)

## Linear Regression Angle

Definition: Calculates the linear regression angle for the input time series
Syntax: `linearreg_angle(period)`
Arguments: `period` - the length of period to use in the calculation
Return: A time series of values representing the linear regression angle for the input time series.
Description: The linear regression angle is the angle of the linear regression line for the input time series.
Example:
linear_reg_angle_values = ETH.close -> linearreg_angle(15)

## Linear Regression Intercept

Definition: Calculates the linear regression intercept for the input time series
Syntax: `linearreg_intercept(period)`
Arguments: `period` - the length of period to use in the calculation
Return: A time series of values representing the linear regression intercept for the input time series.
Description: The linear regression intercept is the y-intercept of the linear regression line for the input time series.
Example:
linear_reg_intercept_values = ETH.close -> linearreg_intercept(15)

## Linear Regression Slope

Syntax: `linearreg_slope(period)`
Arguments:
• `period` - the length of period to use in the calculation
Return: A time series of values representing the linear regression Sslope for the input time series.
Description: The linear regression slope is the slope of the linear regression line for the input time series.
Example:
linear_reg_slope_values = ETH.close -> linearreg_slope(15)

## Standard Deviation

Definition: Calculates the standard deviation for the input time series.
Syntax: `stddev(period, nbdev)`
Arguments:
• `period`: the length of period to use in the calculation
• `nbdev`: deviation multiplier
Return: A time series of values representing the standard deviation for the input time series.
Description: The standard deviation is a measure of the dispersion of the input time series around the mean. It is calculated by taking the square root of the variance. This function allows you to specify the period and the deviation multiplier to use in the calculation.
Example:
stddev_values = ETH.close -> stddev(14, 1)

## Time Series Forecast

Definition: Calculates the time series forecast (TSF) for the input time series.
Syntax: `tsf(period)`
Arguments: `period` - the length of period to use in the calculation
Return: A time series of values representing the time series forecast for the input time series.
Description: The time series forecast is a smoothing function that performs linear least squares regression over a period. It then uses the linear model to predict the value for the next bar. This function allows you to specify the length of the period to use in the calculation.
Example:
tsf_values = ETH.close -> tsf(15)

## Variance

Syntax: `var(period, nbdev)`
Definition: Calculates the variance of the input time series.
Arguments:
• `period`: the number of periods to use in the calculation
• `nbdev`: deviation multiplier
Return: A time series of values representing the variance of the input time series.
Description: The variance is a measure of the dispersion of the input time series around the mean. It is calculated by summing the squares of the differences between the values and the mean and dividing by the number of values. This function allows you to specify the period and deviation multiplier to use in the calculation.
Example:
var_values = ETH.close -> var(15, 1)