Real-world data which represents the time dimension can be used to forecast future scenarios using time series forecasting methods. Autoregression, moving average, autoregressive moving average and automated machine learning (automated ML) methods are time series forecasting methods which focus on establishing a relationship between historical data and future results. Autoregression assumes the future observations at the next timestamp have a linear relationship with prior time stamps. Auto Regression(AR) model makes predictions using previous values in the time series, while Moving Average(MA) makes predictions using the series mean and previous errors.

ARIMA model consists three components: AR, I and MA. AR or Autoregressive component is the value at the present time point that is assumed to be a regression on prior data points, I or Integrated component that is responsible for making the time series stationary and MA or moving average component establishing a relationship between time series’ irregular pattern and past regression errors.
Accuracy always remains a question while modelling and forecasting data. ARIMA models can be combined with artificial neural network (ANN) models to enhance accuracy. Better accuracy can be obtained from ARIMA models for complex time series data when applied in combination with long-term memory (LSTM) networks. The performance of the model can be evaluated using metrics such as mean absolute error (MAE), mean absolute percentage error (MAPE) and root mean square error (RMSE).
ARIMA model is a robust method for time series forecasting and is applicable in various scenarios such as hydrological forecasting, predictions of atmospheric carbon dioxide levels and predicting stock price, foreign exchange rate forecasting, and modelling capital indicators such as Gross Domestic Product (GDP) and Consumer Price Index (CPI).
The example below shows a forecasted model of a synthetic data.
import pandas as pd
import numpy as np
from statsmodels.tsa.arima.model import ARIMA
import matplotlib.pyplot as plt
data.head()
model = ARIMA(data['Price'], order=(1, 1, 1))
model_fit = model.fit()
forecast = model_fit.forecast(steps=5)
plt.figure(figsize=(10, 6))
plt.plot(data.index, data['Price'], label='Historical Stock Price')
forecast_index = pd.date_range(data.index[-1] + pd.offsets.YearEnd(), periods=6, freq='Y')[1:]
plt.plot(forecast_index, forecast, 'r--', label='Forecasted Stock Price')
plt.legend()
plt.title('Stock Price Forecast')
plt.xlabel('Year')
plt.ylabel('Price')
plt.grid(True)
plt.show()

Leave a Reply