Skip to content

Standard Errors Tutorials

Learning Path

Prerequisites: Fundamentals tutorials, basic econometrics Time: 3--8 hours Level: Beginner -- Advanced

Overview

Correct standard errors are essential for valid inference. Panel data frequently violates the classical OLS assumptions: errors may be heteroskedastic, serially correlated within entities, or cross-sectionally dependent across entities. Using the wrong standard errors leads to inflated t-statistics, misleadingly small p-values, and incorrect confidence intervals.

These tutorials cover the complete range of robust inference methods available in PanelBox: heteroskedasticity-consistent (HC0--HC3) standard errors, cluster-robust errors, Newey-West HAC for serial correlation, Conley spatial HAC for geographic correlation, Driscoll-Kraay for cross-sectional dependence, Panel Corrected Standard Errors (PCSE), and bootstrap methods.

The existing Standard Errors Series provides additional depth including a decision tree for method selection.

Which Method Should I Use?

Data Characteristic Recommended Method Notebook
Heteroskedasticity only HC0--HC3 01
Within-entity correlation Cluster-robust 02
Serial correlation (known structure) Newey-West HAC 03
Geographic/spatial correlation Conley Spatial HAC 04
Cross-sectional dependence (large T) Driscoll-Kraay 06
Small sample, unknown structure Bootstrap 07
MLE models Sandwich estimator 05

Notebooks

# Tutorial Level Time Colab
1 Robust Fundamentals (HC0--HC3) Beginner 45 min Open In Colab
2 Clustering in Panels Beginner 45 min Open In Colab
3 HAC (Newey-West) Intermediate 45 min Open In Colab
4 Spatial HAC (Conley) Intermediate 60 min Open In Colab
5 MLE Sandwich Inference Intermediate 45 min Open In Colab
6 Driscoll-Kraay & PCSE Advanced 60 min Open In Colab
7 Methods Comparison Advanced 60 min Open In Colab

Learning Paths

Basic (3 hours)

Essential inference for any panel analysis:

Notebooks: 1, 2

Covers robust SE basics and clustering. These two methods handle the vast majority of applied work.

Intermediate (5 hours)

Add HAC and sandwich methods:

Notebooks: 1, 2, 3, 4, 5

Includes Newey-West, Conley spatial HAC, and sandwich inference for MLE models.

Advanced (8 hours)

Master every inference method:

Notebooks: 1--7

Adds Driscoll-Kraay, PCSE, bootstrap, and a systematic comparison of all methods.

Key Concepts Covered

  • HC0--HC3: Heteroskedasticity-consistent SE (White, MacKinnon-White)
  • Cluster-robust: Accounting for within-cluster correlation
  • Two-way clustering: Simultaneous entity and time clustering
  • HAC (Newey-West): Heteroskedasticity and autocorrelation consistent
  • Spatial HAC (Conley): SE for spatially correlated data
  • Driscoll-Kraay: Cross-sectionally dependent panels (large T)
  • PCSE: Panel Corrected SE (Beck & Katz)
  • MLE sandwich: Robust SE for maximum likelihood estimators
  • Bootstrap: Nonparametric, wild, and block bootstrap

Quick Example

import panelbox as pb

# FE with cluster-robust SE
fe = pb.FixedEffects(
    data=data,
    formula="y ~ x1 + x2",
    entity_col="id",
    time_col="year",
    cov_type="clustered"
).fit()

print(fe.summary())