본문 바로가기
Growth/Timeseries

How to build ARIMA models in Python for time series forecasting

by Diligejy 2022. 9. 12.

https://www.youtube.com/watch?v=-aCF0_wfVwY 

1. What is ARIMA

a. ARIMA(Auto - Regressive Integrated Moving Average) is a general class of statistical models for time series analysis.

b. ARIMA uses a time series' past values and/or forecast errors to predict its future values.

c. ARIMA model assumption - stationary : the time series has its statistical properties remain constant across time.

d. Three components/parameters: AR + I + MA(p, d, q)

 

2. ARIMA(p, d, q)

a. AR(Auto-Regressive) : The time series is linearly regressed on its own past values.

    i. p : The number of past values included in the AR model

b. I (Integrated) : If not stationary, the time series can be differenced to become stationary, i.e,., compute the differences between consecutive observations.

    i. d : The number of times the time series is differenced.

c. MA (Moving Average) : The time series is 'regressed' on the past forecast errors

    i. q : The number of past forecast errors included in the MA Model.

3. ARIMA(p, d, q) full equation

a. AR : ARIMA(p, 0, 0) = AR(p)

b. MA : ARIMA(0, 0, q) = MA(q)

c. ARMA : ARIMA(p, 0, q) 

d. ARIMA

 

4. ACF plot and PACF plot

a. ACF (Autocorrelation function) is the correlation of the time series with its lags, e.g, y_t and y_t-k for k = 1, 2, ...

 

b. 

Question : assume y_t and y_t-1 are correlated, y_t-1 and y_t-2 are correlated.

How can we measure if there is new information in y_t-2 to predict y_t, besides their relationships with y_t-1?

 

c. PACF(Partial Autocorrelation Function) is the partial correlation of the time series with its lags, after removing the effects of lower-order-lags between them.

 

    i. e.g the partial autocorrelation of y_t and y_t-k is the correlation that is not explained by their relationships with the lags y_t-1, y_t-2, ,...., y_t-k+1

 

5. Rule of Thumbs

a. If the PACF plot has a significant spike at lag p, but not beyond; The ACF plot decays more gradually. This may suggest an ARIMA(p, d, 0) model

b. IF the ACF plot has a significant spike at lag q, but not beyond; THE PACF plot decays more gradually. This may suggest  an ARIMA(0, d, q) model.

'Growth > Timeseries' 카테고리의 다른 글

Using ARIMA to Predict Bitcoin Prices in Python in 2022🔴  (0) 2022.09.14

댓글