Data-Based Economics, ESCP, 2025-2026
2026-01-28
The Power of Panels
Panel data lets us separate the individual effect (Alice vs Bob) from the causal effect (Coffee vs No Coffee).
Until now, we have been rather loose about where the data comes from.
Trying to explain \(N\) observations: \(y_n = a + b x_n, n\in [1,N]\)
All these lonely observations, where do they all come from?
Individuals (Space)
(Cross-section)

Dates (Time)
(Time-series)






Context: We want to explain economic growth (\(y\)) using trade openness (\(x\)) for several countries.
The Mistake: “Pooled Regression”
The Reality:

We admit that some individuals are just naturally “higher” or “lower” than others. We give each individual their own starting point (intercept).
\[ y_{i,t} = \underbrace{\alpha_i}_{\text{Individual Intercept}} + \beta x_{i,t} + \epsilon_{i,t}\]
Composed coefficients: (coefficients can also be heterogenous in both dimension)
\[y_{i,t} = \alpha_i + \alpha_t + (\beta_i + \beta_t) x_{i,t} + \epsilon_{i,t}\]
Random coefficients …
The Setup
Formalization
Graphical Intuition

The Calculation
\[ \text{DID} = (\bar{y}_{\text{Treat}, \text{Post}} - \bar{y}_{\text{Treat}, \text{Pre}}) - (\bar{y}_{\text{Control}, \text{Post}} - \bar{y}_{\text{Control}, \text{Pre}}) \]
We estimate it using a regression with an Interaction Term:
\[y_{i,t} = \alpha + \beta_1 \underbrace{\text{Treat}_i}_{\text{Group}} + \beta_2 \underbrace{\text{Post}_t}_{\text{Time}} + \delta (\underbrace{\text{Treat}_i \times \text{Post}_t}_{\text{Interaction}}) + \epsilon_{i,t}\]
Interpretation
\(\delta\) captures the extra jump that the treated group experiences in the second period. This is our causal effect!
Scenario:
The Model: Two-Way Fixed Effects (TWFE) \[y_{i,t} = \underbrace{\alpha_{i}}_{\text{Entity FE}} + \underbrace{\alpha_t}_{\text{Time FE}} + \delta D_{i,t} + \beta x_{i,t} + \epsilon_{i,t}\]
\(D_{i,t}\): The “Post-Treatment” dummy
Conclusion: This is the standard workhorse model for policy evaluation in economics.
Using the linearmodels library (built on top of pandas/statsmodels).
Entity Fixed Effects:
Two-Way Fixed Effects:
Pro Tip
PanelOLS handles the dummy variable math efficiently. Don’t try to create 1000 columns of dummies yourself!
linearmodels in Python to handle the complexity automatically.