# Grid Search for SARIMAX Parameters

Grid Search for SARIMAX Parameters. An easy way to find optimal parameters for your statsmodels SARIMAX model. In this tutorial, you will learn how to run an easy grid search to find the best parameters for your statsmodel SARIMAX time series model. Or you can just copy and paste the code — even easier!

If you’ve landed here, chances are you’re implementing a statsmodels SARIMAX time series model, and you’re looking for an easy way to identify all of the best parameters. And I have some excellent news for you…you’ve landed in the right place!

In this tutorial, you will learn how to run an easy grid search to find the best parameters for your statsmodel SARIMAX time series model. Or you can just copy and paste the code — even easier!

For our SARIMAX model, there are seven sub-parameters total, which on their own would be no easy feat to calculate. However, with a few simple lines of code, we can create a custom grid search that gives us a list of optimal parameters, sorted by users choice of selection criterion (AIC or BIC).

### Selection Criterion

Let’s start with selection criterion. The two choices here are AIC and BIC. These stand for Akaike information criterion and Bayesian information criterion, respectively. And they select for the model that explains the greatest amount of variation using the fewest possible independent variables. [1] The way they calculate this is by using Maximum Likelihood Estimation (MLE), and they both penalize a model for having increasing numbers of variables to prevent overfitting.

There is a lot of discussion around which one is the best to use. BIC will penalize a model more strongly for having an increasing number of variables. If there is more variation expected in future data sets or multiple data sets that the model will be applied to, then I recommend using BIC. As I did here. However, there isn’t a huge difference, and AIC tends to be common, so really the choice is all yours.

## A Real-World Time Series Data Analysis and Forecasting

Applying the ARIMA model to forecast time series dataThe notion of stationarity of a series is important for applying statistical forecasting models since.

## Simple Multivariate Time-Series Forecasting

This tutorial was supposed to be published last week. Except I couldn’t get a working (and decent) model ready in time to write an article about it.

## Time Series Forecasting: Limitations of LSTMs

While LSTMs have become increasingly popular for time series analysis, they do have limitations. Long-short term memory networks (LSTMs) are now frequently used for time series analysis.

## Why Does Stationarity Matter in Time Series Analysis?

Learn the Fundamental Rule of Time Series Analysis: Stationarity is an important concept in the field of time series analysis with tremendous influence on how the data is perceived and predicted.

## Fundamentals of Time Series Forecasting

What if you can know how much you are going to spend next week? Or if you can tell the number of hours of sleep you will get the next day?