Differencing
$$
\text{Differenced series}:\Delta Y_t=Y_t-Y_{t-1}
$$
- When fitting ARMA model, we want the data to be close to stationary
- Stationary means variance, auto-correlation,… will be constant over time
- Differencing will often make the time series stationary
- Log return in stock price series is level one differencing
ARIMA model
- ARIMA(p,d,q) is just a model where we’ve differenced d times before applying ARMA(p,q)
- ARIMA(0,1,0) is I(1) and this is a random walk
$$
\Delta Y_t = \varepsilon_t \\ Y_t-Y_{t-1}=\varepsilon_t \\ Y_t=Y_{t-1}+\varepsilon_t
$$
-
Log return is level one difference and according to random walk, return can’t be predicted from previous values
$$
R_t=P_t-P_{t-1}=\varepsilon_t \sim \N(\mu,\sigma^2)
$$
-
Equation
$$
Y_t=\beta_0+\beta_1Y_{t-1}+...+\beta_pY_{y-p}+\varepsilon_t+\theta_1\varepsilon_{t-1}+...+\theta_q\varepsilon_{t-q}
$$
ARIMA - ADF (Augmented Dickey–Fuller) Test for stationary
- First apply differencing (order d)
- Then fit ARMA(p,q)

Code & Test
Data