Indexof

Lite v2.0Cross Validated › Mastering Fixed Effects in Difference-in-Differences (DiD) with Monthly Data › Last update: About

Mastering Fixed Effects in Difference-in-Differences (DiD) with Monthly Data

High-Frequency Causal Inference: Fixed Effects in DiD for Monthly Data

Implementing a Difference-in-Differences (DiD) framework with Monthly Data introduces a layer of granularity that standard annual models lack. While more data usually improves precision, monthly observations require a more sophisticated handling of Fixed Effects to account for seasonal fluctuations, idiosyncratic shocks, and time-invariant unit characteristics. The transition from a basic 2x2 DiD to a Two-Way Fixed Effects (TWFE) model is essential when the timing of policy interventions varies across units or when month-to-month noise could bias the treatment effect. This guide explores how to structure these effects to isolate the true causal signal from high-frequency temporal trends.

Table of Content

Purpose

The primary purpose of using fixed effects in a monthly DiD setup is to control for unobserved heterogeneity across two dimensions:

  • Unit Fixed Effects ($\gamma_i$): Captures all factors specific to a city, firm, or individual that do not change over time (e.g., geographic location or stable corporate culture).
  • Time (Month) Fixed Effects ($\lambda_t$): Captures macro-level shocks that affect all units simultaneously in a given month (e.g., national economic shifts or holidays).
In monthly data, these effects are critical because they absorb Seasonality—the predictable patterns that repeat every 12 months—which would otherwise be incorrectly attributed to the treatment.

Use Case

This technical approach is vital for:

  • Retail Policy Analysis: Evaluating the impact of a plastic bag tax implemented in different cities at different months.
  • Labor Economics: Tracking the effect of a minimum wage increase on monthly employment rates.
  • Digital Marketing: Assessing the "lift" of a new advertising algorithm rolled out across different regions in staggered phases.
  • Public Health: Measuring the change in monthly hospital admissions following a local healthcare reform.

Step-by-Step

1. Define the TWFE Regression Equation

For monthly data, the standard model is: $$Y_{it} = \alpha + \beta D_{it} + \gamma_i + \lambda_t + \epsilon_{it}$$ Where:

  • $Y_{it}$: The outcome for unit $i$ in month $t$.
  • $D_{it}$: A binary indicator (1 if unit $i$ is treated in month $t$, 0 otherwise).
  • $\gamma_i$: Unit Fixed Effects.
  • $\lambda_t$: Month-Year Fixed Effects (e.g., "Jan 2026").

2. Structure the Time Variable

In monthly DiD, you cannot use a simple "Month" variable (1-12). You must use a Date-Time Index.

  1. Ensure your data is in "Long" format.
  2. Create a unique dummy for every single month-year combination in the sample. This accounts for specific shocks like "The inflation spike of March 2026."

3. Verify Parallel Trends with Event Study Plots

Monthly data allows for a granular Event Study. Instead of one treatment coefficient, estimate coefficients for months leading up to and following the intervention:

  • If the pre-treatment monthly coefficients are near zero, the parallel trends assumption likely holds.
  • Significant pre-trends suggest that units were already diverging before the policy, invalidating the DiD.

4. Cluster Standard Errors

Because monthly observations within the same unit are highly correlated (autocorrelation), you must cluster standard errors at the unit level ($i$). Failure to do so will lead to overly optimistic p-values and false claims of significance.

Best Results

Fixed Effect Type Monthly Implementation Technical Benefit
Unit (Individual/Entity) Dummy for each ID Controls for time-invariant selection bias.
Month-of-Year 12 Dummies (Jan-Dec) Removes recurring seasonal cycles (e.g., winter slowdown).
Time (Month-Year) Dummy for every $T$ Absorbs all global monthly shocks.
Unit-Specific Trends $Unit_i \times Time_t$ Relaxes parallel trends by allowing units to grow at different rates.

FAQ

Should I use 'Month' or 'Month-Year' fixed effects?

In a DiD, you should almost always use Month-Year fixed effects (e.g., a dummy for October 2025). Simple "Month" fixed effects (a dummy for October regardless of year) only control for seasonality but fail to control for year-specific shocks.

What if my treatment happens at the start of the month?

If treatment occurs mid-month, you may need to decide whether to code that month as "0" or "1" for the treatment indicator, or use a continuous "Exposure" variable based on the fraction of the month treated.

Can I use Fixed Effects if I only have two months of data?

Yes, but this reverts to the "Basic 2x2 DiD." Fixed Effects are most powerful when you have a long pre-treatment period to establish stable trends and account for seasonality.

Disclaimer

The Two-Way Fixed Effects estimator can be biased if the treatment effects are heterogeneous over time or across units (the "Bacon Decomposition" problem). If you have staggered treatment timing, consider using specialized estimators like Callaway & Sant’Anna (2021). This guide reflects econometric best practices as of March 2026.

Tags: Econometrics, FixedEffects, DifferenceInDifferences, CausalInference

Profile: A technical tutorial on implementing Two-Way Fixed Effects (TWFE) for Difference-in-Differences models using high-frequency monthly data. Learn to handle seasonality and staggered treatment. - Indexof

About

A technical tutorial on implementing Two-Way Fixed Effects (TWFE) for Difference-in-Differences models using high-frequency monthly data. Learn to handle seasonality and staggered treatment. #cross-validated #masteringfixedeffectsindifferenceindifferences


Edited by: Lucas Jensen, Charalambos Constantinides, Pietro Guerra & Jethro Labitigan

Close [x]
Loading special offers...

Suggestion