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 Analysis

Research Depth 242 in the knowledge graph ☐ I know this ☆ Set as goal
37topics build on this
1,503prerequisites beneath it
See this on the map →
Natural Experiments and Quasi-Experimental DesignTemporal Clustering and Seasonality Analysis→→Synthetic Control and Comparative Case Studies
quasi-experimental policy-evaluation temporal-analysis

Core Idea

Difference-in-differences (DiD) compares changes over time between exposed and unexposed groups, differencing out time-invariant confounding. If pre-exposure trends are parallel, DiD estimates the causal effect of a policy or intervention. DiD generalizes to multiple time periods and accommodates time-varying confounders unaffected by the intervention.

Explainer

You know from your study of natural experiments that some real-world events create exposure variation that is not determined by individual choice — a policy rollout that affects some states but not others, a factory closure in one town, a sudden price change. These events give researchers leverage to estimate causal effects without randomized assignment. Difference-in-differences (DiD) is the statistical technique that formalizes this leverage into an estimator.

The logic of DiD is easiest to grasp through a concrete example. Suppose a new smoking cessation program is introduced in California in 2015, but not in Nevada. You observe lung cancer incidence in both states from 2010 to 2020. Naively, you might compare post-2015 lung cancer rates in California to Nevada — but California might have had lower rates to begin with, biasing the comparison. Instead, DiD asks: how much did California's rate *change* relative to Nevada's rate? If California's incidence dropped by 8 per 100,000 between 2010–2015 and 2015–2020, while Nevada's dropped by 3 per 100,000 over the same period, the DiD estimate is 8 − 3 = 5 per 100,000, the excess reduction attributable to the program.

More formally, the estimator is: DiD = (Exposed post − Exposed pre) − (Unexposed post − Unexposed pre). The first difference removes time-invariant differences between California and Nevada (perhaps California always had lower smoking rates). The second differencing removes secular trends affecting both states equally (perhaps incidence was falling nationally due to improved treatment). What remains — the *difference in the differences* — isolates the variation attributable to the intervention.

The key assumption is parallel trends: in the absence of the intervention, both groups would have followed the same trajectory. This is not testable for the post-period (counterfactual), but it can be assessed by examining pre-intervention trends. If California and Nevada had similar trends from 2010 to 2015 before the program was introduced, the parallel trends assumption is more credible. A visual plot of pre-period trends is the standard diagnostic. When pre-trends diverge, DiD estimates are biased, because the trend difference itself would have produced outcome differences even without any intervention.

DiD generalizes powerfully. With panel data across many states and multiple years, DiD estimates are implemented via regression models with entity fixed effects (removing time-invariant confounders for each state) and time fixed effects (removing common temporal trends). This two-way fixed-effects design is the workhorse of policy evaluation in economics and epidemiology. More recent methodological work has complicated this picture — showing that when treatment timing is staggered across units, two-way FE estimators can produce distorted estimates if treatment effects evolve over time — leading to newer "heterogeneity-robust" DiD estimators. Understanding the classical DiD framework first gives you the conceptual foundation to follow and apply these refinements.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → One-to-One Correspondence → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Making 10 as an Addition Strategy → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Iterated Integrals and Fubini's Theorem → Double Integrals in Cartesian Coordinates → Double Integrals in Polar Coordinates → Double Integrals in Polar Coordinates → Double Integrals: Definition and Setup → Iterated Integrals and Fubini's Theorem → Double Integrals over Rectangular Regions → Double Integrals over General Regions → Applications of Double Integrals: Area, Mass, and Moments → Triple Integrals in Cartesian Coordinates → Triple Integrals in Cylindrical and Spherical Coordinates → Change of Variables and the Jacobian Determinant → Applications of Triple Integrals: Volume and Mass → Vector Fields and Their Representations → Line Integrals of Vector Fields → Work and Circulation → Line Integrals of Scalar and Vector Functions → Fundamental Theorem for Line Integrals → Conservative Vector Fields → Conservative Vector Fields and Potential Functions → Curl and Divergence of Vector Fields → Curl and Divergence → Divergence Theorem → Electric Flux and Divergence Theorem → Gauss's Law: Integral Form and Meaning → Solving Problems with Gauss's Law → Conductors in Electrostatic Equilibrium → Capacitance and Capacitors → Dielectrics → Dielectric Constant and Relative Permittivity → Electric Field Inside Dielectric Materials → Dielectric Materials and Polarization → Dielectric Susceptibility and Permittivity → Energy Density in Electric Fields → Electric Current and Current Density → Electrical Resistance and Resistivity → Ohm's Law and Circuit Elements → Electromotive Force (EMF) and Batteries → Kirchhoff's Circuit Laws: Voltage and Current → DC Circuit Network Analysis Methods → Transient Response in RC Circuits → RC Circuits → LC and RLC Circuits → AC Circuits: Fundamentals → Impedance and Reactance → AC Power and Resonance → Electromagnetic Waves → Postulates of Special Relativity → Time Dilation → Length Contraction → Lorentz Transformation → Relativistic Velocity Addition → Relativistic Momentum and Energy → Mass-Energy Equivalence and E=mc² → Photons as Particles with Energy and Momentum → Planck-Einstein Relation: Energy and Frequency → Photoelectric Effect → The Photon: Light as Quanta → Compton Scattering → Wave-Particle Duality → de Broglie Wavelength → The Schrödinger Equation → State Vectors and Wavefunctions → Quantum Superposition → The Measurement Problem → Interpretations of Quantum Mechanics → Postulates of Quantum Mechanics → Observables and Quantum Operators → Commutators and Commutation Relations → Quantum Angular Momentum → Quantum Mechanical Treatment of Hydrogen → Solving the Schrödinger Equation for Hydrogen Atom → Quantum Numbers → Electron Configuration → Periodic Trends → Covalent Bonding → Electronegativity and Bond Polarity → Ionic Bonding → Lewis Structures → VSEPR Theory and Molecular Geometry → Molecular Geometry and Electron Pair Geometry → Molecular Polarity and Dipole Moments → Intermolecular Forces → States of Matter and Phase Changes: Melting, Boiling, and Sublimation → Gas Laws and the Ideal Gas Equation → Gas Stoichiometry and Volume-Volume Calculations → Thermochemistry and Enthalpy → Heat Capacity and Calorimetry → Entropy and Molecular Disorder → Spontaneity and ΔG → Entropy and Gibbs Free Energy → Chemical Equilibrium → Acid-Base Chemistry → Weak Acid Ionization → Weak Base Ionization → Acid and Base Strength: Ka, Kb, and Ionization → Leaving Groups and Nucleofugality → SN2 Substitution Reactions → SN1 Substitution Reactions → E1 Elimination Reactions → Alcohols and Ethers: Structure, Properties, and Nomenclature → Reactions of Alcohols → Aldehydes and Ketones: Structure and Reactivity → Oxidation Reactions in Organic Chemistry → Oxidation of Alcohols to Aldehydes and Ketones → Aldehyde and Ketone Structure and Nomenclature → Nucleophilic Addition to Aldehydes and Ketones → Carboxylic Acids and Their Derivatives → IUPAC Nomenclature of Carbonyls and Carboxylic Acids → IUPAC Nomenclature of Alkenes → Electrophilic Addition to Alkenes → Aromaticity and Benzene → Electrophilic Aromatic Substitution (EAS) → Nucleophilic Aromatic Substitution (SNAr) → Nucleophilic Acyl Substitution → Amines: Structure, Basicity, and Reactions → Amine Reactivity: Nucleophilicity and Basicity → Amino Acid Structure and Properties → Peptide Bonds and Polypeptide Formation → Protein Primary Structure → Protein Secondary Structure → Protein Tertiary Structure → Enzyme Structure and Function → Transcription: DNA to RNA → RNA Types and Structure → RNA Structure and Intramolecular Base Pairing → RNA Processing and Splicing → Translation: RNA to Protein → Ribosomes: Protein Synthesis Machines → Translation: Initiation and Elongation → Post-Translational Modifications → Proteasomal Degradation and Ubiquitin-Mediated Marking → Cell Cycle Regulation and Checkpoints → Mitosis → Cytokinesis → Meiosis → Chromosomal Theory of Inheritance → Mendelian Genetics → Dominance, Recessiveness, and Allelic Interactions → Sex-Linked Inheritance → Non-Mendelian Inheritance Patterns → Population Genetics and Hardy-Weinberg Equilibrium → Natural Selection → Adaptation and Fitness → Life History Strategies: r- and K-Selection → Predator-Prey Dynamics and the Lotka-Volterra Model → Community Ecology: Structure and Organization → Species Interactions: Competition, Predation, Mutualism, and Parasitism → Trophic Levels and Food Webs → Energy Flow and Ecological Efficiency → Biogeochemical Cycles: Carbon, Nitrogen, and Phosphorus → Microbial Ecology and Biogeochemical Cycling → Symbiosis, Commensalism, and Parasitism in Microbes → Human Microbiome → Emerging Infectious Diseases → Infectious Disease Surveillance Systems → Outbreak Investigation → Epidemic Curve Interpretation and Outbreak Analysis → Temporal Clustering and Seasonality Analysis → Interrupted Time Series Design → Natural Experiments and Quasi-Experimental Design → Difference-in-Differences Analysis

Longest path: 243 steps · 1503 total prerequisite topics

Prerequisites (2)

Leads To (1)