📘 MORISTAT: Advanced Econometrics

Chapter 3: Panel Data Models

Version 1.0  ·  July 2026  ·  naglal@linux-mauritius.com
3.1 What Is Panel Data?

Definition: Panel data (also called longitudinal data) consists of observations on the same individuals (entities) over multiple time periods.

Panel Data Structure:

Entity i = 1, 2, ..., N (individuals, firms, countries) Time t = 1, 2, ..., T (years, quarters, months) Yᵢₜ = β₀ + β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + μᵢ + εᵢₜ
EntityTimeYX₁X₂...Xₖ
11y₁₁x₁₁₁x₂₁₁...xₖ₁₁
12y₁₂x₁₁₂x₂₁₂...xₖ₁₂
1Ty₁Tx₁₁Tx₂₁T...xₖ₁T
21y₂₁x₁₂₁x₂₂₁...xₖ₂₁
22y₂₂x₁₂₂x₂₂₂...xₖ₂₂
NTyNTx₁NTx₂NT...xₖNT

Types of Panel Data:

TypeDescriptionExample
Balanced PanelAll entities have the same number of time periodsN=100, T=10, total=1000 obs
Unbalanced PanelSome entities have missing observationsFirms enter/exit the sample
Short PanelN large, T small (N >> T)Many firms, few years
Long PanelN small, T large (N << T)Few countries, many years

Why Use Panel Data?

AdvantageDescription
Control for Unobserved HeterogeneityEntity-specific effects are captured
More VariationBoth cross-section and time variation
Dynamic EffectsStudy adjustment over time
Better IdentificationControl for omitted variables bias
More ObservationsN × T vs N (cross-section) or T (time)
3.2 The Panel Data Model

The General Panel Model:

Yᵢₜ = β₀ + β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + μᵢ + εᵢₜ

Where:

The Error Components:

uᵢₜ = μᵢ + εᵢₜ
ComponentDescriptionProperties
μᵢEntity-specific effectTime-invariant, captures unobserved heterogeneity
εᵢₜIdiosyncratic errorVaries across both i and t, assumed i.i.d.

Key Assumptions:

  1. E(εᵢₜ | X, μᵢ) = 0 — Idiosyncratic error is uncorrelated with regressors
  2. E(εᵢₜ² | X, μᵢ) = σ² — Homoskedasticity
  3. E(εᵢₜεᵢₛ | X, μᵢ) = 0 for t≠s — No serial correlation
  4. E(εᵢₜεⱼₛ | X, μᵢ) = 0 for i≠j — No cross-sectional correlation
The Entity Effect μᵢ

The entity effect μᵢ captures all unobserved, time-invariant factors that affect Y:

Examples of μᵢ:

Key Question: Is μᵢ correlated with the regressors?

3.3 Pooled OLS

What Is Pooled OLS?

Pooled OLS simply ignores the panel structure and estimates:

Yᵢₜ = β₀ + β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + uᵢₜ

It pools all observations together (N × T observations).

The Problem with Pooled OLS

Pooled OLS is valid only if:

  1. No entity-specific effects (μᵢ = 0)
  2. Or μᵢ is uncorrelated with all regressors

If μᵢ ≠ 0 and correlated with X: Pooled OLS is biased and inconsistent.

When to Use Pooled OLS:

SituationRecommendation
μᵢ = 0 (no entity effects)Use Pooled OLS
μᵢ ≠ 0 but uncorrelated with XUse Random Effects (more efficient)
μᵢ ≠ 0 and correlated with XUse Fixed Effects
3.4 Fixed Effects (FE)

The Fixed Effects Model:

Yᵢₜ = β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + μᵢ + εᵢₜ

Key Assumption: μᵢ is correlated with X (allows for arbitrary correlation).

Estimation Methods:

1. Within Transformation (Demeaning)

Subtract the entity-specific mean from each variable:

Yᵢₜ - Ȳᵢ = β₁(X₁ᵢₜ - X̄₁ᵢ) + β₂(X₂ᵢₜ - X̄₂ᵢ) + ... + βₖ(Xₖᵢₜ - X̄ₖᵢ) + (εᵢₜ - ε̄ᵢ)

Where:

This removes μᵢ because μᵢ - μᵢ = 0.

2. First-Difference Transformation

Subtract the previous period:

(Yᵢₜ - Yᵢ,ₜ₋₁) = β₁(X₁ᵢₜ - X₁ᵢ,ₜ₋₁) + β₂(X₂ᵢₜ - X₂ᵢ,ₜ₋₁) + ... + βₖ(Xₖᵢₜ - Xₖᵢ,ₜ₋₁) + (εᵢₜ - εᵢ,ₜ₋₁)

This also removes μᵢ because μᵢ - μᵢ = 0.

3. Least Squares Dummy Variable (LSDV)

Include entity-specific dummies:

Yᵢₜ = β₀ + β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + δ₂D₂ + δ₃D₃ + ... + δₙDₙ + εᵢₜ

Where Dⱼ = 1 if entity = j, 0 otherwise.

Properties of FE:

PropertyDescription
ConsistentAs N → ∞ or T → ∞
UnbiasedOnly if T is fixed (within transformation)
EfficiencyOLS on transformed data is BLUE
Time-Invariant VariablesCannot be estimated (they are differenced out)

Advantages of FE:

  1. Controls for all time-invariant omitted variables
  2. Does not require μᵢ to be uncorrelated with X
  3. Robust to many forms of omitted variable bias

Disadvantages of FE:

  1. Cannot estimate time-invariant variables (e.g., gender, race)
  2. Can be inefficient if μᵢ is actually uncorrelated with X
  3. Requires variation within entities over time
3.5 Random Effects (RE)

The Random Effects Model:

Yᵢₜ = β₀ + β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + μᵢ + εᵢₜ

Key Assumption: μᵢ is uncorrelated with X (Cov(X, μ) = 0).

The Error Structure:

uᵢₜ = μᵢ + εᵢₜ

Variance Structure:

Estimation: GLS (Feasible GLS)

RE uses Generalized Least Squares (GLS):

β̂_RE = (X'Ω⁻¹X)⁻¹X'Ω⁻¹Y

Where Ω is the variance-covariance matrix of the errors.

In practice, we use Feasible GLS (FGLS) with estimated variance components:

  1. Estimate σ²_ε from FE
  2. Estimate σ²_μ from between variation
  3. Compute θ = 1 - σ_ε / √(Tσ²_μ + σ²_ε)
  4. Apply GLS transformation

The GLS Transformation:

Y*ᵢₜ = Yᵢₜ - θȲᵢ X*ⱼᵢₜ = Xⱼᵢₜ - θX̄ⱼᵢ

Where:

Special cases:

Properties of RE:

PropertyDescription
ConsistentIf Cov(X, μ) = 0
EfficientUses both within and between variation
Can EstimateTime-invariant variables
BiasedIf Cov(X, μ) ≠ 0

Advantages of RE:

  1. More efficient than FE (uses more variation)
  2. Can estimate time-invariant variables
  3. Better for long panels (T large)

Disadvantages of RE:

  1. Requires Cov(X, μ) = 0 (strong assumption)
  2. Biased and inconsistent if assumption fails
3.6 Hausman Test

Choosing Between FE and RE:

The Hausman test determines whether the RE assumption (Cov(X, μ) = 0) is valid.

The Test:

Null Hypothesis: H₀: Cov(X, μ) = 0 (RE is consistent)

Alternative: H₁: Cov(X, μ) ≠ 0 (RE is inconsistent, FE is consistent)

The Test Statistic:

H = (β̂_FE - β̂_RE)'[Var(β̂_FE) - Var(β̂_RE)]⁻¹(β̂_FE - β̂_RE)

Under H₀, H ~ χ²(k), where k = number of time-varying regressors.

Interpretation:

ResultDecisionMeaning
p ≥ 0.10Use RERE is consistent and efficient
p < 0.05Use FERE is inconsistent
0.05 ≤ p < 0.10MarginalUse FE to be safe
Intuition
3.7 Within vs Between Variation

Understanding the Components:

Panel data contains two types of variation:

1. Within Variation

Variation of a variable around its entity-specific mean:

Xᵢₜ - X̄ᵢ

Captures: Changes within entities over time

Used by: Fixed Effects (FE)

2. Between Variation

Variation of entity-specific means:

X̄ᵢ - X̄

Captures: Differences across entities

Used by: Between Estimator

3. Total Variation
Xᵢₜ - X̄ = (Xᵢₜ - X̄ᵢ) + (X̄ᵢ - X̄)

Which Estimator Uses What?

EstimatorVariation UsedInterpretation
Pooled OLSTotalMix of within and between
FEWithin onlyChanges within entities over time
REWeighted mixBoth within and between
BetweenBetween onlyDifferences across entities
3.8 Dynamic Panel Models

The Dynamic Panel Model:

Many economic processes are dynamic:

Yᵢₜ = αYᵢ,ₜ₋₁ + β₁X₁ᵢₜ + β₂X₂ᵢₜ + ... + βₖXₖᵢₜ + μᵢ + εᵢₜ

Where Yᵢ,ₜ₋₁ is the lagged dependent variable.

Why Dynamics Matter:

  1. State dependence: Past outcomes affect current outcomes
  2. Adjustment costs: Adjustment to equilibrium takes time
  3. Habit formation: Current behavior depends on past behavior
  4. Partial adjustment: Gradual adjustment to desired levels
The Problem with Dynamic Panels

Nickell Bias (1981): In short panels (T small), FE is biased and inconsistent.

Source of bias: The lagged dependent variable Yᵢ,ₜ₋₁ is correlated with μᵢ, and the within transformation induces correlation with εᵢ,ₜ₋₁.

Cov(Yᵢ,ₜ₋₁, μᵢ) ≠ 0 → Correlated with entity effect Cov(Yᵢ,ₜ₋₁, εᵢₜ) ≠ 0 → After within transformation

Arellano-Bond GMM

The Arellano-Bond Difference GMM estimator addresses the Nickell bias.

Difference GMM:

First-difference the model to remove μᵢ:

ΔYᵢₜ = αΔYᵢ,ₜ₋₁ + β₁ΔX₁ᵢₜ + β₂ΔX₂ᵢₜ + ... + βₖΔXₖᵢₜ + Δεᵢₜ

Instruments:

Use lagged values of Y and X as instruments:

For ΔYᵢₜ = Yᵢₜ - Yᵢ,ₜ₋₁: Instruments: Yᵢ,ₜ₋₂, Yᵢ,ₜ₋₃, ..., Xᵢ,ₜ₋₁, Xᵢ,ₜ₋₂, ...

Validity: Lagged values are correlated with Yᵢ,ₜ₋₁ but uncorrelated with Δεᵢₜ.

System GMM

Blundell-Bond System GMM improves efficiency by combining:

  1. Difference equations (like Arellano-Bond)
  2. Level equations (with lagged differences as instruments)

Better for: Persistent series (Y is close to a random walk)

GMM Diagnostics:

TestPurposeRule
AR(1)Test for first-order autocorrelationExpected (p < 0.05)
AR(2)Test for second-order autocorrelationShould not be significant (p > 0.05)
Sargan/Hansen JOveridentification testp > 0.10 (instruments valid)
3.9 Applications and Examples
Example 1: Production Function Estimation

Research Question: What is the elasticity of output with respect to inputs?

Dataset: Firm-level panel data (N=5000 firms, T=10 years)

Model:

Log(Output)ᵢₜ = β₁Log(Capital)ᵢₜ + β₂Log(Labor)ᵢₜ + β₃Log(Materials)ᵢₜ + μᵢ + εᵢₜ

Endogeneity Concern: Input choices are correlated with productivity (μᵢ)

Solution: FE or IV with lagged inputs

VariableOLSFESystem GMM
Capital0.12**0.08**0.09**
Labor0.45**0.38**0.40**
Materials0.35**0.32**0.33**
Example 2: Economic Growth

Research Question: What determines economic growth?

Dataset: Country-year panel (N=100 countries, T=30 years)

Model:

Growthᵢₜ = β₁InitialGDPᵢₜ + β₂Investmentᵢₜ + β₃Educationᵢₜ + β₄Tradeᵢₜ + μᵢ + εᵢₜ

Endogeneity Concern: Growth affects investment (simultaneity)

Solution: FE + GMM

VariableFESystem GMM
Initial GDP-0.02**-0.01**
Investment0.15**0.12**
Education0.08**0.06**
Trade0.05**0.04**
Example 3: Healthcare Utilization

Research Question: How does insurance affect healthcare utilization?

Dataset: Individual-year panel (N=10,000 individuals, T=5 years)

Model:

DoctorVisitsᵢₜ = β₁Insuredᵢₜ + β₂Ageᵢₜ + β₃Incomeᵢₜ + μᵢ + εᵢₜ

Endogeneity Concern: Health status affects both insurance and utilization

Solution: FE (controls for individual health status)

VariablePooled OLSFE
Insured2.45**1.12**
Age0.03**0.02**
Income0.01**0.00
N50,00050,000

Interpretation: The OLS estimate is biased upward because healthier people are more likely to be insured.

3.10 Implementation in Practice

Checklist for Panel Data Analysis:

Common Mistakes to Avoid:

MistakeWhy It's WrongWhat To Do Instead
Using Pooled OLS with entity effectsBiased and inconsistentUse FE or RE
Using FE for time-invariant variablesDropped from estimationUse RE or between estimator
Ignoring serial correlationInefficient SEsUse clustered SEs
Overinterpreting FE estimatesFE uses only within variationInterpret as changes over time
Using GMM with too many instrumentsOverfittingLimit instruments
3.11 Decision Tree for Panel Data
Do you have panel data? └─── No → Use cross-section or time series methods └─── Yes → Proceed Are entity effects μᵢ present? └─── No (F-test not significant) → Use Pooled OLS └─── Yes → Proceed Is μᵢ correlated with X? └─── No (Hausman test p ≥ 0.10) → Use Random Effects (RE) └─── Yes (Hausman test p < 0.05) → Use Fixed Effects (FE) Is the model dynamic? (has lagged Y) └─── No → Use FE or RE └─── Yes → Use Arellano-Bond GMM Is your panel short (T small)? └─── No (T large) → FE is OK └─── Yes (T small) → Use System GMM
3.12 Quick Reference Cards

Panel Models Summary:

ModelKey FeatureAssumptionEstimation
Pooled OLSIgnore panel structureμᵢ = 0OLS
Fixed Effects (FE)Entity-specific interceptsCov(X, μ) ≠ 0Within
Random Effects (RE)Random entity effectsCov(X, μ) = 0GLS
BetweenBetween variation onlyCov(X, μ) ≠ 0OLS on means

Hausman Test Summary:

H = (β̂_FE - β̂_RE)'[Var(β̂_FE) - Var(β̂_RE)]⁻¹(β̂_FE - β̂_RE) If p ≥ 0.10 → Use RE (consistent and efficient) If p < 0.05 → Use FE (RE is inconsistent)

FE vs RE Comparison:

AspectFERE
AssumptionCov(X, μ) ≠ 0Cov(X, μ) = 0
Time-invariant variablesCannot estimateCan estimate
EfficiencyLess efficientMore efficient
ConsistencyAlways consistentConsistent only if assumption holds
3.13 Chapter Summary

Key Takeaways:

  1. Panel data combines cross-section and time series — More variation and better identification
  2. Unobserved heterogeneity is the key issue — μᵢ captures time-invariant entity effects
  3. FE controls for any correlation between μᵢ and X — Uses within variation
  4. RE is more efficient but requires Cov(X, μ) = 0 — Uses both within and between variation
  5. Hausman test chooses between FE and RE — If p < 0.05, use FE
  6. Dynamic panels require GMM — Arellano-Bond addresses Nickell bias
  7. Always check for serial correlation — Use clustered standard errors
  8. Report both FE and RE — Compare to assess robustness

Checklist Before Proceeding:

3.14 What's Next?
📘 Chapter 4: Advanced Topics in Econometrics

In the next chapter, we will cover:

  1. Limited Dependent Variable Models — Logit, Probit, Tobit
  2. Binary Choice Models — Interpretation and marginal effects
  3. Censored and Truncated Models — Tobit regression
  4. Count Data Models — Poisson and Negative Binomial
  5. Duration Models — Survival analysis
  6. Mixture Models — Finite mixtures and latent class analysis
  7. Spatial Econometrics — Spatial autocorrelation and dependence
  8. Machine Learning in Econometrics — Ridge, Lasso, and beyond