To grid search ARIMA hyperparameters in Python, define a small set of plausible (p,d,q) orders, fit each model on training data only with statsmodels.tsa.arima.model.ARIMA, and rank successful fits by a consistent information criterion such as AIC. Then validate a shortlist on later observations in time. The lowest training AIC is a screening result—not proof that a model will forecast best.
What ARIMA hyperparameters are you searching?
In a nonseasonal ARIMA model, order=(p,d,q) sets three integers: p is the autoregressive lag order, d is the nonseasonal differencing order, and q is the moving-average lag order. The statsmodels ARIMA API accepts this tuple in its model constructor.
When a defensible seasonal pattern exists, add seasonal_order=(P,D,Q,s). Here P, D, and Q are seasonal counterparts to the nonseasonal orders, and s is the number of observations in a seasonal cycle. For example, monthly observations with an annual cycle may use s=12; that period should reflect the data, not be assumed for every monthly series.
Statsmodels provides the ARIMA model, not a built-in grid-search method for these tuples. A grid search is a loop you write: define candidates, fit each one, record results on comparable data, and use a stated selection rule.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Design a bounded candidate grid
Choose ranges that are small enough to fit and broad enough to represent plausible dynamics. For example, p and q values from 0 through 3 and a few considered values of d can make an initial search. These are illustrative limits, not recommended defaults for every series. Each extra value multiplies the number of fits; seasonal dimensions multiply it further.
- Use trend and stationarity evidence to decide which differencing orders
dto consider. Too little differencing may leave a stochastic trend; too much may remove meaningful structure. - Add seasonal terms only when the data supports a seasonal cycle, and set
sto that cycle’s period. - Keep the final chronological evaluation period out of candidate fitting and selection.
- Compare candidates using the same observations where possible; differing effective samples can make information-criterion comparisons misleading.
Stationarity tests such as ADF and KPSS can inform the differencing decision, but they do not mechanically determine a universally correct order. Statsmodels lists these tools and residual tests in its time-series overview.
Split the series in time before fitting
Do not shuffle time-series observations into random training and test sets. Train on earlier observations and validate on later ones, so evaluation reflects the direction in which forecasts will actually be made. The statsmodels ARIMA tutorial discusses chronological splitting and held-out evaluation as common-pitfall safeguards.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Set aside a final period for evaluation before searching. If you have enough history, use earlier training data for order screening, compare finalists on one or more later validation windows, then reserve the final period for an unbiased final check. Repeating the evaluation at rolling forecast origins can reveal whether a model ranking depends heavily on one particular cutoff.
Fit candidates and record failures transparently
The following example runs a compact nonseasonal search. It records fitting exceptions and convergence warnings instead of silently treating every attempted fit as successful. It assumes train is a one-dimensional training series in chronological order; it does not use a held-out validation or test segment.
import warnings
import numpy as np
from statsmodels.tsa.arima.model import ARIMA
rows = []
for p in range(4):
for d in range(3):
for q in range(4):
order = (p, d, q)
try:
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
result = ARIMA(train, order=order).fit()
rows.append({
"order": order,
"aic": result.aic,
"converged": result.mle_retvals.get("converged", None),
"warnings": [str(w.message) for w in caught],
"result": result,
"error": None,
})
except (ValueError, np.linalg.LinAlgError) as exc:
rows.append({
"order": order,
"aic": np.nan,
"converged": False,
"warnings": [],
"result": None,
"error": str(exc),
})
successful = [
row for row in rows
if row["result"] is not None
and row["converged"] is not False
and np.isfinite(row["aic"])
]
ranked = sorted(successful, key=lambda row: row["aic"])
for row in ranked[:10]:
print(row["order"], row["aic"], row["warnings"])
Warnings and the optimizer’s convergence status need review; convergence metadata is available in fitted results, but its exact contents may vary with statsmodels versions and optimization settings. Do not assume that a numerically returned result is a trustworthy fit. Inspect failed and excluded rows rather than hiding them, and retain the complete candidate log so the selection is reproducible.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
To include seasonality, add bounded loops for P, D, and Q, choose a justified s, and construct the model with both tuples:
result = ARIMA(
train,
order=(p, d, q),
seasonal_order=(P, D, Q, s),
).fit()
The seasonal API and tuple meanings are documented in the ARIMA reference. An official seasonal-differencing example uses monthly Mauna Loa CO₂ data with a visible upward trend and annual cycle, and demonstrates ARIMA(1,1,1)(0,1,0,12). That is an example for that dataset, not a general prescription for monthly data.
Use AIC to screen, then validate forecasts
AIC gives a consistent within-search screening criterion when candidates are fitted to comparable observations. It does not tell you directly how accurate forecasts will be at your intended horizon. Keep a shortlist rather than selecting solely by the smallest training AIC.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Generate forecasts from each finalist using only the history available at each forecast origin. Compare forecast errors on later observations at the horizon that matters to your use case, using an error measure aligned with the cost of being wrong. A model with a higher AIC may be preferable if it forecasts that horizon more reliably or has more defensible residual behavior.
Statsmodels distinguishes prediction interfaces such as predict, forecast, and get_forecast in its ARIMA tutorial. Match the method and forecast interval to the evaluation you intend to perform; do not use observations from the evaluation period to fit a candidate first.
Check residuals and model complexity
After narrowing the candidate list, inspect residual behavior and convergence alongside forecast error. Residual autocorrelation suggests the model may have left time structure unexplained; the statsmodels overview includes the Ljung–Box test among its residual tools. Diagnostics complement out-of-sample evaluation rather than replacing it.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
More lags are not automatically better. The statsmodels tutorial warns that overly complex p and q choices can overfit. Prefer a simpler candidate when its validation performance is comparable and its residuals are adequate, particularly if a larger model adds estimation cost or unstable fits.
Know when other order-selection tools fit
Statsmodels’ arma_order_select_ic computes information-criterion comparisons for ARMA orders. Because ARMA does not search the differencing order d as a full ARIMA grid does, it is not a direct substitute when you need to compare differencing choices. The same overview documents x13_arima_select_order, a distinct seasonal order-identification workflow that depends on an external X-12/X-13 ARIMA program rather than a drop-in Python grid loop.
Refit only after the selection rule is fixed
Once the order-selection procedure and validation results identify a specification, you can refit that specification on all data designated for model development before producing forecasts. Keep the final test period untouched until the procedure is settled if you need a final performance estimate. Record the candidate ranges, data split dates, criterion, exclusions, warnings, forecast horizon, and validation errors so another analyst can reproduce the decision.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

