Skip to content
LeetQuant
QR03 Statistical Inference and Estimation

QR03 · Statistical Inference and Estimation · Lesson 4 of 4

Diagnostics and Model Comparison

Check a fitted model with residual plots, QQ plots and formal tests, compare models with likelihood ratios, AIC, BIC and cross-validation, and recognise the warning signs of overfitting.

18 min

Two separate questions

After fitting a model, ask two things. Is it adequate? That is diagnostics: do the residuals look like what the model says they should be? Is it better than the alternatives? That is model comparison: does the extra complexity of a bigger model earn its keep out of sample? A model can win a comparison and still be inadequate (the best of a bad set), and every standard error from the earlier lessons is only as good as the diagnostics behind it.

Residual diagnostics

If the model is right, the standardised residuals should be approximately i.i.d. with the assumed distribution. Each assumption has a check:

AssumptionPlotFormal test
Correct mean functionresiduals vs fitted values or each regressor: no curvatureRESET, adding squared terms
Constant varianceresiduals vs fitted: no funnel; squared residuals vs timeBreusch–Pagan, White (score tests)
No serial correlationACF of residuals within ±2/n\pm 2/\sqrt n bandsLjung–Box, Durbin–Watson
No volatility clusteringACF of squared residualsARCH-LM, Ljung–Box on squares
Distribution (e.g. normal)QQ plotJarque–Bera, Shapiro–Wilk
No dominant pointsleverage, Cook's distancerefit without them

The Ljung–Box statistic for the first mm residual autocorrelations ρ^k\hat\rho_k is

Q=n(n+2)∑k=1mρ^k2n−k  ∼  χm−p2,Q = n(n+2)\sum_{k=1}^m \frac{\hat\rho_k^2}{n - k} \;\sim\; \chi^2_{m - p} ,

where pp is the number of ARMA parameters estimated (0 for regression residuals without ARMA terms). The Jarque–Bera statistic combines sample skewness SS and kurtosis KK:

JB=n6(S2+(K−3)24)  ∼  χ22.JB = \frac n6\left(S^2 + \frac{(K - 3)^2}{4}\right) \;\sim\; \chi^2_2 .

Reading a QQ plot

Plot sorted standardised residuals against the corresponding normal quantiles. Normal data lie on the line y=xy = x.

  • Heavy tails: an S-shape lying under the line at the left end and over it at the right. The extreme residuals are more extreme than normal quantiles predict. Daily returns always look like this.
  • Light tails: the opposite S, flattening at both ends.
  • Right skew: points curve above the line at both ends, a convex (U-shaped) bow; left skew bows the other way.
  • A few isolated points far off at one end: outliers, data errors or genuine jumps. Investigate them before modelling them.

The plot shows where the misfit is (tails versus centre), which a single test statistic cannot.

Formal tests: what they can and cannot say

With large nn every test rejects, because no model is exactly right: 5,000 daily returns will reject normality for any real asset. With small nn nothing rejects, which is not evidence the model is fine. Use tests to flag problems and plots and effect sizes to judge whether the problem matters for your purpose (fat tails matter a lot for VaR and little for a point forecast of the mean).

Worked example

checking regression residuals

A factor regression on 250 daily returns leaves residuals with skewness −0.4-0.4, kurtosis 5.05.0, and first three autocorrelations 0.120.12, −0.05-0.05 and 0.080.08. Test normality and serial correlation at 5%.

Show solution

Jarque–Bera: JB=2506(0.16+2.024)=41.67×1.16≈48.3JB = \tfrac{250}{6}\left(0.16 + \tfrac{2.0^2}{4}\right) = 41.67 \times 1.16 \approx 48.3. The 5% critical value of χ22\chi^2_2 is 5.995.99 and the p-value is about 3×10−113 \times 10^{-11}: normality is firmly rejected, driven almost entirely by the excess kurtosis term (1.01.0 against 0.160.16 for skewness).

Ljung–Box with m=3m = 3:

Q=250×252(0.0144249+0.0025248+0.0064247)≈5.91.Q = 250 \times 252\left(\frac{0.0144}{249} + \frac{0.0025}{248} + \frac{0.0064}{247}\right) \approx 5.91 .

Against χ32\chi^2_3 (critical value 7.817.81) the p-value is about 0.120.12: no significant serial correlation, although ρ^1=0.12\hat\rho_1 = 0.12 is just under the 2/250≈0.1262/\sqrt{250} \approx 0.126 band.

Conclusion: the coefficient estimates are fine, but normal-theory standard errors and any normal VaR built from this model are suspect. Use robust (sandwich) standard errors, check the squared residuals for volatility clustering, and consider fat-tailed errors before quoting tail risk.

Comparing models

A bigger model always fits the training data at least as well, so in-sample log-likelihood alone always prefers it. Three tools correct for that.

Likelihood ratio, for nested models. If model 0 is model 1 with rr parameters restricted, 2(ℓ1−ℓ0)∼χr22(\ell_1 - \ell_0) \sim \chi^2_r under the smaller model. It is a test, not a selection criterion: it controls the false-positive rate for "the bigger model is needed", and it requires nesting.

Information criteria, for any models fitted to the same data. With kk parameters and maximised log-likelihood ℓ\ell,

AIC=2k−2ℓ,BIC=klog⁡n−2ℓ,\text{AIC} = 2k - 2\ell, \qquad \text{BIC} = k \log n - 2\ell ,

and the lower value wins. Each extra parameter must raise ℓ\ell by more than 11 under AIC and by more than 12log⁡n\tfrac12 \log n under BIC (3.453.45 for n=1000n = 1000). Compare: the LR test with one restriction at 5% requires ℓ\ell to rise by 3.84/2=1.923.84/2 = 1.92.

They answer different questions. AIC estimates out-of-sample predictive accuracy (expected KL divergence); it is asymptotically equivalent to leave-one-out cross-validation and tends to pick slightly too-large models, which is acceptable when the goal is prediction. BIC approximates the log marginal likelihood (the Bayesian evidence); it is consistent, picking the true model with probability tending to one if it is in the candidate set, and it punishes complexity more as nn grows. Only differences matter: a gap below about 2 is weak evidence, above 10 is strong. Both need the same data, the same response (no comparing models of yy with models of log⁡y\log y without the Jacobian) and a full likelihood.

Cross-validation, for anything. Fit on part of the data and score on the rest. It needs no likelihood and no parameter count, so it works for regularised, tree-based or hand-tuned models whose effective number of parameters is unclear, and it measures real out-of-sample error even when the model is misspecified. The costs are computation and noise (the CV estimate itself has a sizeable variance). For time series, never shuffle: use walk-forward or blocked folds, with a gap (purging) between training and test periods so overlapping labels and autocorrelation do not leak information.

Worked example

AIC, BIC and the LR test disagree

Three nested models are fitted by maximum likelihood to n=500n = 500 observations: A with 3 parameters, ℓ=−1210.4\ell = -1210.4; B with 4 parameters, ℓ=−1207.9\ell = -1207.9; C with 7 parameters, ℓ=−1203.6\ell = -1203.6. Which does each criterion choose?

Show solution

With log⁡500=6.215\log 500 = 6.215:

Modelkk−2ℓ-2\ellAICBIC
A32420.82426.82439.4
B42415.82423.82440.7
C72407.22421.22450.7

AIC picks C; BIC picks A (A beats B by 1.2 and C by 11.3).

LR tests: B vs A gives 2×2.5=5.02 \times 2.5 = 5.0 on 1 degree of freedom, p-value 0.0250.025. C vs B gives 2×4.3=8.62 \times 4.3 = 8.6 on 3 degrees of freedom (critical value 7.817.81), p-value 0.0350.035. Sequential testing at 5% therefore also ends at C.

The disagreement is the usual one. Each step of extra fit is real but modest, about 1.4 to 2.5 log-likelihood units per parameter, above AIC's threshold of 1 and below BIC's 3.13.1. If the purpose is forecasting and the extra parameters have an economic story, C is defensible; if the purpose is to identify a structural model, or the candidates were found by search, BIC's preference for A is the safer bet. When the criteria disagree, the deciding evidence should be out-of-sample performance and the stability of C's extra coefficients across subperiods.

Warning signs of overfitting

  • A large gap between in-sample and out-of-sample performance, or out-of-sample R2R^2 below zero (worse than predicting the mean).
  • Many parameters relative to effective observations. For returns, the effective sample is limited by the number of independent periods, not rows: 10 years of daily data on 2,000 stocks is not 5 million independent points.
  • Unstable coefficients: signs and sizes that change across subperiods, bootstrap resamples or small specification changes.
  • Sensitivity to hyperparameters: performance that collapses when a lookback moves from 20 to 22 days.
  • Implausibly good results: a backtest Sharpe ratio of 4 from daily data on liquid futures, or a fitted curve that tracks every wiggle.
  • Silent selection: the reported model is the best of many tried. The criteria above assume the candidate set was fixed in advance; searching over hundreds of specifications breaks every one of them, including cross-validation if the same folds are reused for selection and evaluation.

Knowledge check

With n = 1000 observations, adding one parameter to a model raises the maximised log-likelihood by 2.5. What do AIC and BIC say?

Knowledge check

On a normal QQ plot of daily return residuals, the points lie below the line at the far left and above the line at the far right, and close to it in the middle. What does this indicate?

Knowledge check

You choose the lookback of a momentum signal by 5-fold cross-validation with randomly shuffled daily observations, using 20-day forward returns as the target. The CV error is much lower than the error in a later walk-forward test. What is the most likely cause?

Key takeaways

  • Diagnostics test adequacy: residuals should show no structure in the mean, variance, autocorrelation or distribution. Ljung–Box, Jarque–Bera and Breusch–Pagan formalise the plots.
  • QQ plots show where the misfit is: an S-shape below-left and above-right means heavy tails.
  • LR tests compare nested models; AIC (2k−2ℓ2k - 2\ell) targets prediction and behaves like leave-one-out CV; BIC (klog⁡n−2ℓk\log n - 2\ell) targets the true model and penalises more as nn grows.
  • Cross-validation needs no likelihood or parameter count but must respect time order and label overlap in financial data.
  • Overfitting shows up as in-sample/out-of-sample gaps, unstable coefficients, fragile hyperparameters and results that are too good. Selection over many models invalidates every criterion unless it is accounted for.

Practice problems

Finished reading?

Answer the 3 knowledge checks to complete this lesson (0 done).