All data analysis guides

Data Analysis

Time Series Analysis: Stationarity, ARIMA and Forecast Accuracy

GOSPELTRADER Research Desk · 12 September 2026 · 12 min read

Quick answer

Time series analysis models data ordered in time, where observations are dependent. The workflow is fixed: plot and decompose the series, test stationarity with the ADF and KPSS tests, difference until stationary, identify p and q from the ACF and PACF, estimate the ARIMA(p,d,q) model, confirm the residuals are white noise with the Ljung-Box test, then evaluate forecasts on a held-out period using RMSE and MAPE.

1. Decompose before you model

Every series is examined as trend, seasonality, and remainder before any model is fitted. An additive decomposition suits a series whose seasonal swings stay a constant size; a multiplicative one suits a series whose swings grow with the level — which is common in revenue, traffic and price data.

If the variance grows with the level, take logs first. A log transform turns multiplicative seasonality into additive seasonality and stabilises variance, and forecasts are back-transformed at the end.

Additive        Y_t = T_t + S_t + R_t
Multiplicative  Y_t = T_t × S_t × R_t   ⇔   ln Y_t = ln T_t + ln S_t + ln R_t

2. Stationarity: two tests, opposite hypotheses

ARIMA requires a stationary series — constant mean, constant variance, and an autocovariance that depends only on the lag. The two standard tests point in opposite directions, so run both and read them together.

TestNull hypothesisStationary when
Augmented Dickey-Fuller (ADF)A unit root is present (non-stationary)p < .05 (reject the null)
KPSSThe series is stationaryp > .05 (fail to reject)
Both agreeConfident conclusion; proceed
Tests disagreeDifference once and retest, or model a deterministic trend

3. Differencing and choosing d

Differencing removes trend; seasonal differencing removes a repeating pattern. Use the smallest d that achieves stationarity — over-differencing introduces artificial negative autocorrelation at lag 1 and inflates forecast variance.

First difference       ΔY_t = Y_t - Y_{t-1}
Second difference      Δ²Y_t = ΔY_t - ΔY_{t-1}
Seasonal difference    Δ_s Y_t = Y_t - Y_{t-s}   (s = 12 monthly, 4 quarterly)

Rule of thumb: d ≤ 2 and D ≤ 1 in almost every applied series.

4. Identify p and q from ACF and PACF

After differencing, the correlogram of the stationary series identifies the model orders. The classic signatures are reliable for clean series; for messy real data, compare candidate models on AICc rather than eyeballing alone.

ACF patternPACF patternSuggested model
Tails off graduallyCuts off after lag pAR(p) — ARIMA(p,d,0)
Cuts off after lag qTails off graduallyMA(q) — ARIMA(0,d,q)
Tails offTails offMixed ARMA — compare by AICc
Spike at lag s, 2s, 3sSpike at lag sSeasonal terms: ARIMA(p,d,q)(P,D,Q)ₛ

5. Diagnostics and forecast accuracy

A model is only adequate when its residuals are indistinguishable from white noise: no significant autocorrelation, roughly constant variance, and a mean of zero. The Ljung-Box test formalises this, and a non-significant result is the one you want.

Accuracy is judged out of sample. Split the series chronologically — never randomly — hold back the final 10-20% as a test period, and compare candidate models on the same horizon.

Ljung-Box   Q = n(n+2) Σ (r_k² / (n - k))  ,  want p > .05

RMSE  = sqrt( Σ(y_t - ŷ_t)² / n )        same units as the series
MAE   = Σ |y_t - ŷ_t| / n                robust to outliers
MAPE  = (100/n) Σ |(y_t - ŷ_t)/y_t|      % error; undefined near zero
MASE  = MAE / MAE_naive                  < 1 beats the naive forecast

Frequently asked questions

How much data does a time series model need?

For a non-seasonal ARIMA, aim for at least 50 observations. For a seasonal model, you need several complete cycles — at least three years of monthly data, and four or more is safer. Fewer points mean the seasonal pattern cannot be separated from noise.

Should I use auto.arima or choose the orders manually?

Use automatic selection as a starting point, then verify it. Automatic routines minimise AICc but can miss an obvious seasonal term or accept residual autocorrelation. Always inspect the ACF of residuals and the Ljung-Box test on whatever model the algorithm returns.

What is the difference between ARIMA and exponential smoothing?

ARIMA models autocorrelation in a stationary series; exponential smoothing (ETS) models level, trend and seasonal components with decaying weights. ETS often wins on short, strongly seasonal business series and needs less preprocessing, so fit both and compare on the same held-out period.

Can I use cross-validation with time series?

Not ordinary k-fold, because it leaks future information into the training set. Use rolling-origin evaluation: fit on the first n points, forecast h steps, move the origin forward and repeat, then average the errors across all origins.

Want this analysis done for you?

We deliver cleaning, assumption testing, modelling and a reporting-ready write-up.

Start a project
Chat on WhatsApp