Time Series Forecasting: SARIMAX & PROPHET

Rayan Yassminh
3 min readApr 9, 2023

--

SARIMAX_versus_Prophet.png

Welcome to the world of time series forecasting in data science!

Time series forecasting is a branch of data science that deals with predicting future values of a variable based on its historical data. It is a widely used technique in various fields such as finance, economics, engineering, and social sciences. In time series forecasting, we analyze patterns in the data to make predictions about future values. This involves using various statistical and machine learning algorithms to model the data, identify trends and seasonality, and make accurate predictions.

There are many applications of time series forecasting, such as predicting stock prices, weather patterns, consumer demand for products, and many more. With the increasing availability of data and advances in machine learning techniques, time series forecasting is becoming more important than ever. So, whether you are a business analyst, data scientist, or anyone interested in predicting future events, time series forecasting is a powerful tool that can help you make informed decisions and gain valuable insights from your data.

In this article, I plan to utilize the two primary libraries for time series forecasting, SARIMAX & PROPHET. The initial focus will be on a comparative analysis of both libraries, followed by a case study on house pricing. Within this project, I have employed several models to determine the optimal approach for predicting house prices within a specific region.

What is SARIMAX?

SARIMAX is a popular statistical model used in time series forecasting to predict future values of a variable, especially when the data has a seasonal component. It is an extension of the ARIMA model, which can handle both seasonal and non-seasonal time series data with the help of exogenous variables. The model consists of four components: seasonality, autoregression, integration, and moving average. The seasonality component captures the periodicity of the data, while the autoregressive component uses past values to predict future values. The integration component removes any trends in the data, and the moving average component adjusts the forecast for the errors made in previous predictions. Additionally, the model allows for the inclusion of exogenous variables that may impact the outcome. Overall, SARIMAX is a powerful tool for time series forecasting that can handle complex data patterns and multiple variables.

What is Prophet?

Prophet is an open-source forecasting library developed by Facebook that makes it easy for non-experts to generate accurate forecasts for time series data. It is built on top of the Python language and uses a Bayesian approach to model the uncertainty in the data and provide probabilistic forecasts. FBProphet uses a decomposition-based model to separate a time series into trend, seasonality, and holidays components, allowing users to easily identify and account for these factors in their forecasts. In addition, FBProphet is capable of handling missing data and outliers through imputation and outlier detection algorithms. Overall, FBProphet is a powerful and user-friendly forecasting tool that is widely used in various industries for time series forecasting applications.

As the saying goes, “a picture is worth a thousand words”, so in the introduction plot, I have summarized each of these libraries.

Case Study: Housing Price Forecasting.

The Prophet model incorporating the unemployment rate as an exogenous variable demonstrates comparatively lower RMSE outcomes based on the final results.

| Models                                               | Test RMSE    |
|------------------------------------------------------|--------------|
| Prophet - with unemployment rate | 24497.133969 |
| Prophet - with hyperparameter tuning | 32846.063920 |
| SARIMAX(0,1,2)(0, 1, 2, 12) with unemployment rate | 37281.051291 |
| SARIMAX(0,1,2)(0, 1, 2, 12) with interest rate | 38451.338606 |
| SARIMAX(0,1,2)(0, 1, 1, 12) with unemployment rate | 41224.575814 |
| Prophet - with interest rate | 41479.047361 |
| Auto_ARIMA(0,1,2)(0,1,1)12 | 41663.812983 |
| SARIMA(0,1,2)(0,1,2)12 | 41996.987995 |
| Prophet - with intrest and umemployment rates | 55671.439278 |

--

--

Rayan Yassminh

I am a machine learning scientist with a broad STEM background. I aim to explain basic concepts using practical and straightforward examples.