Diagnostics After Fitting a Time Series Model
1) Why diagnostics matter
After you fit a time series model to data, the central question becomes:
Did the model actually capture the predictable structure in the data, or is there still systematic pattern left over?
The model’s “leftovers” are the residuals (prediction errors). If the model is appropriate, those residuals should look like:
- white noise (no time dependence left),
- with constant variance, and
- (under the Gaussian assumption) approximately normal.
So diagnostics focus on two main checks:
- Distribution check: Are residuals approximately normal?
- Autocorrelation check: Are residuals approximately uncorrelated over time?
If residuals fail these checks, it suggests the fitted model is missing something (wrong order, missing seasonal structure, missing differencing, nonconstant variance, non-Gaussian shocks, outliers, structural change, etc.).
2) Standardized residuals: definition and meaning
2.1 One-step-ahead prediction and prediction error
Consider a mean-zero stochastic process . For each time , define the best linear prediction of using all available past observations :
This is a linear combination of past values:
The one-step-ahead prediction error is:
and its variance is defined as:
2.2 Standardizing the errors
Raw prediction errors can have different variances depending on time index (especially early in a series, or depending on the model’s internal recursion). To make them comparable, divide each error by its standard deviation:
These are called standardized residuals.
2.3 Why standardized residuals should look like variance-1 white noise
Three key properties follow directly from this construction:
- Mean is 0
The predictor has the same mean as , so . Dividing by keeps the mean 0. - Variance is 1
By definition, , so dividing by forces: - No correlation across time
A standard result for optimal one-step prediction errors in this setting is that they are pairwise uncorrelated. Scaling by constants does not change correlation, so:
Putting these together: satisfies the definition of white noise with variance 1.
2.4 What you actually have in data
You do not observe ; you observe one realization . If the fitted model truly generated the data, then the computed standardized residuals:
should behave like one realized path of variance-1 white noise—meaning:
- the residual ACF should look like noise,
- the residual distribution should be close to normal (if Gaussian noise is assumed).
If not, that contradicts the “this model generated the data” idea and signals model inadequacy.
3) Residuals vs standardized residuals (the scaling issue)
In many software outputs you may see both:
- Unstandardized residuals:
- Standardized residuals:
A common simplification for fitted ARMA models is that the prediction error variance is proportional to the estimated shock variance . In that case, dividing by produces a version that differs only by a constant scaling from the fully standardized form. Because of that, plots of residuals and standardized residuals usually look the same up to vertical rescaling.
The important point is interpretability:
- Standardized residuals are on a common variance-1 scale.
- That makes normality checks and “is this unusually large?” reasoning more meaningful.
4) What diagnostic plots are trying to show (high-level interpretation)
A typical diagnostic output after fitting a model includes:
- Standardized residual time plot
Quick visual screening for:- remaining trend or seasonality (systematic patterns),
- changing variance over time (volatility clustering),
- outliers or bursts.
- Residual ACF plot
If the model captured the dependence structure, residual autocorrelations should be small and mostly within approximate confidence bands. One isolated spike can happen by chance, but many spikes or systematic tailing indicates remaining structure. - Normal Q–Q plot
Checks whether residuals are approximately normal. - A plot or table of Ljung–Box p-values across lags
Formalizes the residual autocorrelation check across multiple lags simultaneously.
5) Normal Q–Q plot: what it checks and how to read it
5.1 Purpose
A Q–Q plot compares:
- the ordered residuals (your data),
against - the ordered quantiles of a target distribution (here: standard normal).
If residuals are normally distributed, the points fall approximately on a straight line.
This is not a formal proof; it is a visual diagnostic that is very good at showing:
- heavy tails,
- skewness,
- outliers.
5.2 What each point represents (point-by-point meaning)
Let standardized residuals be . Sort them:
Now generate target probabilities designed to spread evenly across , for example:
Compute the corresponding normal quantiles:
where is the inverse CDF of .
Then the Q–Q plot points are:
So the -th smallest residual is paired with the -th normal quantile.
5.3 How to interpret shapes
- Straight line: residual distribution is close to normal.
- Curving outward at both tails: residuals have heavier tails than normal (more extreme values).
- One tail deviates more: skewness.
- A few points far from the line: outliers.
A small tail deviation is common in real data and not automatically disqualifying; the question is whether the deviations are large enough to matter for your modeling goals.
6) Ljung–Box test: a formal check for residual autocorrelation
6.1 Why the residual ACF plot is not enough
ACF plots usually show approximate 95% confidence bands for each lag separately. But you can have a situation where:
- every lag is “barely” inside the band,
- yet collectively the residuals show meaningful correlation.
The Ljung–Box statistic aggregates information across many lags at once.
6.2 The Ljung–Box Q-statistic
Let be the sample autocorrelation of the standardized residuals at lag . For a chosen maximum lag , define:
where is the length of the residual series.
This statistic becomes large when the residual autocorrelations are collectively large.
6.3 Hypothesis test and degrees of freedom correction
When you fit an ARMA(p,q) model, you have already used the data to estimate parameters (plus possibly a mean). This affects how you compare the test statistic to a reference distribution.
The standard approach is:
- Null hypothesis: residuals are uncorrelated up to lag .
- Compare to a chi-square distribution with:
A small p-value indicates you reject the null and conclude there is remaining autocorrelation structure in residuals—meaning the model did not fully capture time dependence.
6.4 Interpreting a p-value plot over many lags
If you compute the Ljung–Box p-value for each in a range (e.g., ) and plot them:
- If p-values are mostly above a threshold like 0.05, residuals look consistent with white noise across those lag ranges.
- If many p-values drop below 0.05, that is evidence of leftover dependence.
7) What it means if diagnostics “fail”
If diagnostics show problems, typical implications are:
- Residual ACF significant: model order is too low, or wrong AR/MA balance, or missing seasonal terms, or missing differencing, or structural break.
- Residual variance changes over time: consider transformations (log), variance models, or identify regime changes/outliers.
- Q–Q plot shows heavy tails/outliers: Gaussian assumption may be imperfect; inference based on normality may be less reliable; robust alternatives may be needed.
Diagnostics are not just about “passing tests.” They guide model refinement.
8) Practical diagnostic workflow (what you should check every time)
After fitting an ARMA/SARIMA-type model:
- Plot standardized residuals over time (look for obvious structure).
- Plot residual ACF (look for remaining autocorrelation).
- Produce a normal Q–Q plot (check normality).
- Run Ljung–Box over a range of values (check joint correlation).
- If anything looks problematic, revise model structure and repeat.
