A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Difference-in-Differences

College Depth 118 in the knowledge graph I know this Set as goal
48topics build on this
660prerequisites beneath it
See this on the map →
Causal Inference and the Identification ProblemDummy Variables and Categorical Regressors+4 moreInterrupted Time Series DesignParallel Trends Assumption: Validity and Testing+2 more
DiD difference-in-differences parallel-trends policy-evaluation

Core Idea

Difference-in-differences (DiD) estimates causal treatment effects by comparing the pre-to-post change in the treatment group to the pre-to-post change in a comparison group. The estimator is β̂_DiD = (Ȳ_treated,post − Ȳ_treated,pre) − (Ȳ_control,post − Ȳ_control,pre), which differences out both pre-existing differences and aggregate time trends. The critical identifying assumption is parallel trends: in the absence of treatment, the treatment and control groups would have followed the same trajectory. This assumption is untestable at the exact period of treatment but is supported by showing parallel pre-trends in the data.

How It's Best Learned

Replicate Card and Krueger's (1994) minimum wage study using New Jersey and Pennsylvania as treatment and control — this is the canonical DiD application in labor economics.

Common Misconceptions

Explainer

You already know from the potential outcomes framework that the fundamental problem of causal inference is that we can never observe the same unit in both the treated and untreated states at the same time. The naive fix — compare treated units to untreated units after treatment — fails because the groups may differ for reasons unrelated to treatment. Difference-in-differences solves this by using time to construct the missing counterfactual. Instead of asking "what would the treated group have looked like untreated?", DiD asks "how did the treated group's trajectory differ from the control group's trajectory during the same period?"

The estimator is literally two differences stacked. First, you difference within each group: compute the before-to-after change for the treatment group and the before-to-after change for the control group. Then you difference the two differences. This double-differencing cancels out anything that was stable over time within each group (fixed differences in levels) and anything that affected both groups equally across time (common time trends). What remains is the portion of the treated group's change that cannot be explained by the time trend alone — the treatment effect.

The identifying assumption — parallel trends — is the load-bearing pillar of every DiD study. It says that in the absence of treatment, the treatment and control groups would have moved in parallel over time. This is explicitly a claim about a counterfactual you cannot observe. What you can do is check pre-treatment periods: if the two groups were trending in parallel before treatment, it is more plausible they would have continued to do so. The canonical example, Card and Krueger (1994), compared fast-food employment in New Jersey (raised minimum wage) and Pennsylvania (did not) before and after the policy change. The DiD estimate found no negative employment effect — a landmark result precisely because the research design was credible.

In practice, DiD is implemented as a regression. You create a treatment dummy (1 = treatment group), a post dummy (1 = after treatment), and their interaction. The coefficient on the interaction term is the DiD estimate. This connects directly to your dummy variable knowledge: the interaction isolates the group-period cell where treatment occurred. Adding additional covariates and unit fixed effects (which you know from fixed effects models) further controls for confounders and absorbs unit-level heterogeneity, strengthening the design. The key caution from the misconceptions is worth internalizing: parallel trends is a claim about counterfactual *trends*, not about levels — the groups can be very different in absolute terms before treatment begins.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersDividing IntegersUnit RatesProportionsPercent ConceptConverting Between Fractions, Decimals, and PercentsOperations with Rational NumbersTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesAngle Pairs: Complementary, Supplementary, and VerticalParallel Lines and TransversalsCorresponding AnglesAlternate Interior AnglesTriangle Angle Sum TheoremExterior Angle TheoremTriangle Inequality TheoremSimilar Triangles: AA SimilaritySimilar Triangles: SSS and SAS SimilarityProportions in Similar TrianglesRight Triangle Trigonometry IntroductionSine, Cosine, and Tangent RatiosTrigonometric Ratios ReviewRadian MeasureConverting Between Degrees and RadiansThe Unit CircleGraphing Sine and CosineGraphing Tangent and Reciprocal Trigonometric FunctionsDerivatives of Trigonometric FunctionsAntiderivativesIndefinite IntegralsBasic Integration RulesRiemann SumsDefinite Integral DefinitionProbability Density Functions and Continuous DistributionsCumulative Distribution FunctionsContinuous Random VariablesProbability Density FunctionsExpected ValueWeak Law of Large NumbersProbability Axioms and RulesConditional ProbabilityIndependence of EventsSampling DistributionsStandard Error of EstimatorsHypothesis Testing: Framework and LogicP-values and Statistical SignificanceEffect Size and Practical SignificanceHypothesis Testing: Framework and LogicZ-Tests and T-Tests for MeansOne-Sample Z-Test for MeansOne-Sample and Two-Sample T-TestsInference in Linear RegressionPrediction Intervals in RegressionLinear Regression BasicsResiduals and Goodness of Fit (R²)Simple (Bivariate) OLS RegressionClassical OLS Assumptions (Gauss-Markov)Multiple RegressionInterpreting Regression CoefficientsHypothesis Testing in RegressionF-Test and Joint SignificanceR-Squared and Model FitMulticollinearityRobust Standard ErrorsPanel Data: Structure and AdvantagesFixed Effects ModelsDifference-in-Differences

Longest path: 119 steps · 660 total prerequisite topics

Prerequisites (6)

Leads To (4)