Skip to content

Validation & Diagnostics Tutorials

Learning Path

Prerequisites: At least one model family completed Time: 3--6 hours Level: Intermediate -- Advanced

Overview

Estimation is only half the story. Every panel model rests on assumptions -- exogeneity, no serial correlation, homoskedasticity, stationarity -- and failing to test these assumptions can lead to unreliable results. Diagnostics also help you choose between models (Hausman test, specification tests) and assess robustness (bootstrap, cross-validation, influence analysis).

These tutorials cover two complementary areas. The validation notebooks focus on assumption testing, bootstrap inference, outlier detection, and the PanelExperiment workflow for systematic model comparison. The diagnostics notebooks cover time-series diagnostics relevant for panels: unit root tests, cointegration tests, serial correlation, heteroskedasticity, and spatial diagnostics.

Additional self-contained notebook tutorials are available for specific topics:

Validation Notebooks

# Tutorial Level Time Colab
1 Assumption Tests Intermediate 45 min Open In Colab
2 Bootstrap & Cross-Validation Intermediate 60 min Open In Colab
3 Outliers & Influence Intermediate 45 min Open In Colab
4 Experiments & Model Comparison Advanced 60 min Open In Colab

Diagnostics Notebooks

# Tutorial Level Time Colab
1 Unit Root Tests Intermediate 45 min Open In Colab
2 Cointegration Tests Advanced 60 min Open In Colab
3 Specification Tests Intermediate 45 min Open In Colab
4 Spatial Diagnostics Advanced 45 min Open In Colab

Learning Paths

Essential (3 hours)

Core diagnostics for any panel analysis:

Notebooks: Validation 1, 3 + Diagnostics 1, 3

Covers assumption testing, outlier detection, unit root tests, and specification tests.

Complete (6 hours)

Full validation and diagnostics coverage:

Notebooks: All 8 notebooks

Adds bootstrap/cross-validation, PanelExperiment workflows, cointegration tests, and spatial diagnostics.

Key Concepts Covered

  • Assumption testing: Heteroskedasticity (Modified Wald), serial correlation (Wooldridge), cross-sectional dependence (Pesaran CD)
  • Hausman test: Fixed vs Random Effects specification
  • Mundlak test: RE with correlated effects
  • Bootstrap: Nonparametric and wild bootstrap for robust inference
  • Cross-validation: Panel-aware k-fold and leave-one-entity-out
  • Outlier detection: DFBETAS, Cook's distance, leverage
  • PanelExperiment: Systematic multi-model comparison with automated reports
  • Unit root tests: LLC, IPS, Fisher (ADF/PP), Pesaran CADF
  • Cointegration: Pedroni, Kao, Westerlund tests
  • Spatial diagnostics: Moran's I, LM tests for spatial specification

Quick Example

from panelbox import PanelExperiment

# Systematic model comparison
exp = PanelExperiment(data, formula="y ~ x1 + x2", entity_col="id", time_col="year")
exp.fit_all_models(["pooled_ols", "fixed_effects", "random_effects"])

# Validate the FE model
val = exp.validate_model("fixed_effects", tests="all")
print(f"Pass rate: {val.pass_rate:.1%}")

# Compare all models
comp = exp.compare_models()
best, _ = comp.best_model(criterion="aic")
print(f"Best model: {best}")

Solutions

Validation Solutions

Tutorial Solution
01. Assumption Tests Solution
02. Bootstrap & CV Solution
03. Outliers & Influence Solution
04. Experiments Solution

Diagnostics Solutions

Tutorial Solution
01. Unit Root Tests Solution
02. Cointegration Solution
03. Specification Tests Solution
04. Spatial Diagnostics Solution