This time, I would like to simulate an ARIMA process in Python with the time series data of Adjusted closing price of Google Stock. The data is downloaded from yahoo finance in period range between 2004-2021.
- Import related library and convert the data into pandas data frame
- Plot the data, which is the adjusted closing price data and see the trend. As we can see the trend is quadratic, so that, we take the d value as 2.
- Run the autocorrelation plot
- Run the Partial autocorrelation in Python to find out the value of p (AR) and q (MA). As both diagram shows that the line crossed the confidence interval (bluecolour-filled space) between line 2 and 3, we took p=2 and q=2
- Run ARIMA process in Python with order 2,1,2 as we have obtained the p, d, and q value beforehand. We took the AR and MA variable that has p value < 5% as p d and
- Plot the residuals. As we can see, there is no trend and showing pure white noise
- Forecast the model. First we run only for the next period we got 2543.89688782 for the forecasted value, 12.95333698 for the standard deviation, and [2518.50881385, 2569.28496179] for the confidence interval
- Run the forecasted model for the next 5 period