ClickHouse / ClickHouse/ClickHouse
Autoregressive Functionality for ClickHouse
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
> (you don't have to strictly follow this form)
**Company or project name**
Prothentic, Inc.
**Use case**
Autoregressive (AR) is a kind of multiple regression method that uses the relationship between the observed value Yt and the observed values in previous periods to predict the value of Y. Among them, the dependent variable is the observed value Yt, and the independent variables are the lagged values of the dependent variable Yt-1, Yt-2,...
The steps of the autoregressive prediction method are as follows:
- Determine the autocorrelation sequence: According to the prediction purpose and requirements, organize the time series data (month, quarter, year) of the prediction target to make it comparable, and divide these series into the dependent variable and independent variable series.
- Determine the regression model: Calculate the autocorrelation coefficient of each independent variable series, and determine the independent variable according to the size of the autocorrelation coefficient, that is, select the independent variable series with a larger autocorrelation coefficient to fit the regression model.
- Estimate the parameters and use the model to predict: The method of finding the value of the model parameters is the same as that of other regression models. The independent variable in the prediction period is the next value of the independent variable series, which can be found in the original time series and used for prediction.
**Describe the solution you'd like**
```
select auto_regress(y -> lambda{ column1 + column2 - y, backward_offset, init_value)
```
Set `t` is the ordering number(aka. row number) of the current row, `y` represents the value evaluated on the lambda expression on the row `t - n` where `n` is specified by `backward_offset`. Given 0 is the first row number, if `t-n` < 0, then set `y` to initial value which is set by argument `init_value`.
The function `auto_regress` is ordering-sensitive and the evaluation of it may not be able to be parallel.
**Describe alternatives you've considered**
**Additional context**
Please contact me on 313259456@qq.com if need more context informantion.
Contributor guide
Assessment
This issue has not been assessed yet.