liveBook · Manning

Arima

As explained in Outlier Detection in Python

ARIMA is a time-series forecasting method that models a value using autoregression, differencing, and moving-average error terms.

ARIMA forecasts time-series values from prior observations by combining autoregression, differencing, and moving-average error terms. It is often an early forecasting choice alongside Exponential Smoothing, while its forecast errors can reveal unusual observations. section 17.2.6

A practical workflow converts timestamped tabular data into a Darts TimeSeries, fits ARIMA on an initial segment, predicts a held-out horizon, and compares predictions with actual values. Parameters require experimental tuning; forecasts may preserve weekly patterns but increasingly rely on the mean farther into the future. section 17.2.6

Forecasting a held-out horizon

Synthetic daily data are generated from the previous value, weekday, and randomness. With ARIMA(p=7, d=2, q=2), the first observations are used for fitting and the final 60 values are predicted. A deliberately enlarged value produces a substantially larger-than-usual forecast error, supporting outlier detection. section 17.2.6

Listing 17.7 Forecasting values using Darts with ARIMA
from darts import TimeSeries
from darts.models import ARIMA
 
df['timestamp'] = df.index                                         #1
series = TimeSeries.from_dataframe(df, "timestamp", "Values")
 
model = ARIMA(p=7, d=2, q=2)                                       #2
model.fit(series[:-60])
pred = model.predict(60)                                           #3
 
pred.plot(label="forecast", low_quantile=0.05, high_quantile=0.95) #4
plt.legend()
plt.show()

Inspect the concise Darts implementation for constructing a TimeSeries, fitting ARIMA, predicting 60 points, and plotting forecast quantiles. section 17.2.6

How Outlier Detection in Python covers it

How deep it goes
Explains the intuition, fitting workflow, held-out prediction, and tuning need without deriving ARIMA internals.
Examples
Uses synthetic weekday-pattern data, a 60-point forecast, plotted quantiles, and a deliberately inserted outlier.
What it assumes
Assumes timestamped time-series data and basic Python data handling, while introducing the fitting and prediction workflow.
What you can do after
Apply it via Darts to fit forecasts, predict a held-out horizon, plot results, and inspect unusually large errors.
How it connects
Connects ARIMA with time-series forecasting, Exponential Smoothing, SARIMA, SARIMAX, and forecast-error outlier detection.

Also explained in

Compare how 2 books explain arima →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.