GARETH GRANTTECHNOLOGY · DATA · INNOVATION
Explore

49 / Decision analytics

Difference-in-differences for business interventions

Difference-in-differences compares changes in an intervention group with changes in a suitable comparison group. It can support a causal interpretation only when the counterfactual assumptions and study design are credible.

AdvancedLive exploration + Python

The business question

Did a business change improve the outcome beyond the change that would otherwise have occurred?

  • Evaluate a phased training, scheduling or service-policy introduction across comparable sites.
  • Avoid attributing a general market improvement entirely to a local intervention.

How the method works

A before-and-after comparison mixes the intervention effect with everything else changing over time. DiD subtracts the comparison group’s change from the intervention group’s change. Persistent differences in starting levels are allowed in the simple additive setup; what matters is how the treated group would have changed without the intervention.

The central identifying assumption is parallel counterfactual trends: absent intervention, the treated and comparison groups would have had the same average change in the outcome under the chosen scale and conditioning. No anticipation, no relevant spillovers and a comparable measurement process also matter. Examine multiple pre-intervention periods and the business reasons for selection, but a non-significant pre-trend test does not prove the assumption.

The four-mean example teaches the point estimator only. It cannot supply a credible standard error, significance claim or causal proof from four aggregated numbers. A real panel study needs an appropriate uncertainty calculation, often clustered at the intervention-assignment level. Staggered adoption, changing composition and heterogeneous effects need suitable modern DiD methods rather than uncritical use of a single two-way fixed-effects coefficient.

The calculation

DiD = (mean_treated_after−mean_treated_before) − (mean_comparison_after−mean_comparison_before).
Read the symbols
SymbolMeaning
Treated groupBusiness units exposed to the intervention in the study period.
Comparison groupUnits used to represent the counterfactual change without the intervention.
Parallel counterfactual trendsAn identifying assumption about what would have happened without treatment, not a directly observed post-treatment trend.

A worked business example

ILLUSTRATIVE SCENARIO

Illustrative service-policy evaluation: two branches report comparable accepted jobs per week before and after one changes its process.

Inputs

  • Treated branch mean: 80 before and 100 after.
  • Comparison branch mean: 70 before and 80 after.
  • These are illustrative aggregates; no underlying panel or assignment study is supplied.

Work through the numbers

  1. Treated change = 100−80 = 20 jobs per week.
  2. Comparison change = 80−70 = 10 jobs per week.
  3. DiD point estimate = 20−10 = 10 jobs per week.
  4. Under additive parallel trends, the treated branch’s no-intervention counterfactual would be 80+10 = 90.
  5. The observed treated outcome 100 exceeds that counterfactual by 10. A naive before/after comparison attributes the full 20 to the intervention.
The illustrative DiD point estimate is an additional 10 accepted jobs per week.

This becomes a causal effect estimate only if the identifying assumptions are defended. Different demand, simultaneous equipment changes or selective staffing could explain the difference instead.

Explore the decision

Calculate a four-mean DiD contrast. The live explorer has its own example inputs; it is separate from the worked calculation above.

Enable JavaScript to use this calculator. The worked example and executable Python remain available.

Apply it at work

  1. Specify the outcome, treatment timing, assignment process and reasons the comparison units are credible.
  2. Collect multiple periods before and after, with comparable definitions, unit identifiers and records of other changes.
  3. Choose an estimator suited to adoption timing and heterogeneity; calculate uncertainty at a defensible assignment or dependence level.
  4. Examine sensitivity to assumptions, pre-period patterns, spillovers and composition before translating the estimate into a rollout decision.

Check these assumptions

  • Parallel untreated trends are plausible under the stated design and outcome scale.
  • Treatment does not change outcomes before its defined introduction.
  • Comparison units are not materially affected by spillovers or treatment-related resource reallocations.
  • Measurement, composition and concurrent changes do not create an unexplained differential trend.

Common mistakes and how to avoid them

  • Failure to detect a pre-trend is not proof of parallel trends, especially with low statistical power.
  • Four summary means provide a point estimate but do not justify an invented p-value or confidence interval.
  • Conventional two-way fixed effects can be misleading with staggered adoption and heterogeneous treatment effects.

How this can help the business

  • A credible comparison can prevent general demand recovery from being mistaken for success of a management practice.
  • An explicit causal design supports better pilot placement and measurement before a costly company-wide rollout.
A decision rule to adapt

Consider expansion only when the effect is practically worthwhile, uncertainty and identifying assumptions are credible, and full costs and quality guardrails support the decision.

When to use another approach

Prefer a randomised phased rollout when feasible; consider interrupted time series, synthetic comparisons or other justified causal designs when DiD assumptions are weak.

Reproduce the worked example in Python

The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.

Show executable code and recorded output
treated_before, treated_after = 80,100
comparison_before, comparison_after = 70,80
treated_change = treated_after-treated_before
comparison_change = comparison_after-comparison_before
did = treated_change-comparison_change
counterfactual = treated_before+comparison_change
print("Treated change:",treated_change,"jobs per week")
print("Comparison change:",comparison_change,"jobs per week")
print("DiD point estimate:",did,"jobs per week")
print("Assumed treated counterfactual:",counterfactual)
print("No p-value: four means do not supply valid uncertainty.")

Recorded output

Treated change: 20 jobs per week
Comparison change: 10 jobs per week
DiD point estimate: 10 jobs per week
Assumed treated counterfactual: 90
No p-value: four means do not supply valid uncertainty.
Download all worked examples

Sources and further reading

Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.