01 / 20

Difference-in-
Differences

Learn how to measure the causal effect of a policy or intervention by comparing treatment and control groups across time.

Business Analytics

What Is Difference-in-Differences?

Difference-in-Differences (DiD) is a statistical technique used to estimate the causal effect of a treatment, policy, or intervention. It compares how an outcome changes over time between a group that receives the treatment and a group that does not.

Two Key Groups

Treatment Group
The group that receives the policy, program, or intervention. We observe them before and after.
Control Group
The group that does not receive the treatment. They serve as the counterfactual baseline.

Why DiD Matters in Business

1
Causal Inference: Goes beyond correlation to estimate actual cause-and-effect relationships.
2
Real-World Data: Works with observational data when randomized experiments are not possible.
3
Policy Evaluation: Used to assess marketing campaigns, pricing changes, new regulations, and product launches.

The DiD Formula

The first difference \( (\bar{Y}_{T,\text{after}} - \bar{Y}_{T,\text{before}}) \) captures the change in the treatment group. The second difference \( (\bar{Y}_{C,\text{after}} - \bar{Y}_{C,\text{before}}) \) captures background trends. Subtracting the second from the first isolates the treatment effect.

Visualizing the DiD Logic

Time Outcome Before After Treatment Control Treatment Counterfactual DiD

The Parallel Trends Assumption

DiD relies on a critical assumption: in the absence of treatment, the treatment and control groups would have followed the same trend over time. This is called the parallel trends assumption.

✓ Parallel Trends Hold Pre-Treatment Post-Treatment C T

DiD vs. Simple Before/After

Simple Before/After Difference-in-Differences
Comparison Same group, two time periods Two groups, two time periods
Controls for Trends? No Yes
Accounts for Shocks? No Yes (if shared)
Key Assumption Nothing else changed Parallel pre-trends
Reliability Low: confounded by time Higher: isolates treatment

How to Apply DiD: Step by Step

1
Identify groups: Define your treatment group and a comparable control group.
2
Collect data: Measure the outcome for both groups before and after the intervention.
3
Check parallel trends: Verify both groups were trending similarly before the treatment.
4
Compute the DiD: Calculate \( \hat{\delta}_{\text{DiD}} = (\Delta Y_T) - (\Delta Y_C) \).
5
Interpret: The result is the estimated causal effect of the treatment.

Example 1: The 2 × 2 Table

A company launches a loyalty program in Store A (treatment) but not Store B (control). Average monthly revenue ($000s):

Before After Change
Store A (Treatment) $120 $160 +$40
Store B (Control) $110 $125 +$15

Example 2: Visualizing the Numbers

$110 $120 $140 $160 Before After Store B: $125 $110 Store A: $160 $120 Counterfactual: $135 $25K

Example 3: The Regression Approach

In practice, DiD is often estimated using a regression equation:

\( \beta_1 \)
Baseline difference between treatment and control groups.
\( \beta_2 \)
Time trend common to both groups (before vs. after).
\( \beta_3 \)
The DiD estimator. This coefficient captures the causal effect.

Interpreting \( \beta_3 \): The Interaction Term

Before (Post = 0) After (Post = 1) Control Treatment
\( \beta_0 \)
\( \beta_0 + \beta_2 \)
\( \beta_0 + \beta_1 \)
\( \beta_0 + \beta_1 + \beta_2 + \beta_3 \)
\( \beta_3 = \text{DiD effect} \)

When DiD Can Fail

1
Parallel trends violated: If the groups were diverging before treatment, the estimate is biased.
2
Spillover effects: If the treatment affects the control group indirectly (e.g., customers switch stores).
3
Composition changes: If the makeup of the groups changes between periods (e.g., different customers).
4
Simultaneous shocks: If a second event (not the treatment) affects only one group during the same period.

Common Mistakes

✕ Ignoring Pre-Trends
Applying DiD without checking whether the groups were trending similarly before the intervention.
✕ Confusing Correlation
Using a simple before/after comparison on one group and calling it DiD. DiD requires two groups.
✕ Wrong Control Group
Choosing a control group that is fundamentally different, making the parallel trends assumption implausible.

Question 1 of 5

What does the Difference-in-Differences method primarily estimate?

Question 2 of 5

A treatment group's outcome rises from 50 to 80, and a control group's outcome rises from 45 to 60. What is the DiD estimate?

Question 3 of 5

What is the key assumption required for Difference-in-Differences to produce an unbiased estimate?

Question 4 of 5

In the regression \( Y_{it} = \beta_0 + \beta_1 \cdot \text{Treat}_i + \beta_2 \cdot \text{Post}_t + \beta_3 \cdot (\text{Treat}_i \times \text{Post}_t) + \varepsilon_{it} \), which coefficient represents the DiD estimate?

Question 5 of 5

A researcher finds that before a new ad campaign, both cities had rising sales, but City A (treatment) was rising faster than City B (control). If she applies DiD, the estimate will be: