SStatistics, Built

Stage III · Master's

Part 37 of 65

Natural Experiments

Master'sstarts at this level63 min of film16 chaptersprerequisites: Part 35, Part 36

When the world runs an experiment by accident, how do you read it?

In 1854 two water companies ran their pipes down the same London streets, and Snow counted 315 cholera deaths per 10,000 houses for one against 37 for the other. The part collects the designs that borrow a piece of randomization in the same way. An instrument identifies an effect by a Wald ratio, and a weak one breaks the usual interval while the Anderson-Rubin set survives. A cutoff gives a regression discontinuity, read with the cutoff lens and checked for sorting. Difference-in-differences needs parallel trends and standard errors clustered by town, and here the part turns: on the World's staggered rollout the standard two-way fixed-effects regression says minus 0.49 when the true effect is 3.96, because it uses already-treated towns as controls. Callaway and Sant'Anna's estimator, synthetic control on Prop 99 and Nickell's bias in panels follow. The part ends with Manski's and Lee's bounds: what the data say before any design is assumed.

What you need. Potential outcomes and the adjustment methods of Parts 35 and 36; regression in matrix form (Part 23).

Hook
Snow's Grand Experiment, 1854
Mathematics
IV, weak instruments, RD, DiD, staggered adoption, synthetic control, SDID, bounds
Built
statkit.quasi

What you will be able to do

Bachelor's

  • Explain Snow's comparison of the two water companies and why it is as good as an experiment.
  • Compute a two-by-two difference-in-differences from four means and say what parallel trends assumes.

Master's

  • Compute a Wald ratio and a 2SLS estimate, and invert the Anderson-Rubin test when the first-stage F is small.
  • Estimate a sharp and a fuzzy regression discontinuity by local linear fits and test the running variable for sorting.
  • Decompose a two-way fixed-effects coefficient into its two-by-two comparisons and replace it with an estimator that never uses treated units as controls.

PhD

  • Derive the bias of a later-versus-earlier comparison when effects grow, and state the restriction under which an honest parallel-trends interval is valid.
  • Explain what synthetic difference-in-differences adds to synthetic control and what its placebo standard errors assume.

Practice

  • Diagnose a design before trusting its estimate: the first-stage F, the density at the cutoff, the pre-period event-study coefficients, the pre-treatment fit.
  • Report a difference-in-differences with standard errors clustered at the unit of treatment, and check the test's size with placebo laws.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 15 min · Master's 56 min · PhD 63 min · Practice 22 min.

  1. 0Snow's Grand ExperimentBachelor's4 min
  2. 1The credibility revolutionBachelor's3 min
  3. 2Instrumental variablesMaster's5 min
  4. 3Weak instrumentsMaster's4 min
  5. 4Many instruments; Mendelian randomizationMaster's4 min
  6. 5Regression discontinuityMaster's5 min
  7. 6RD validityPractice5 min
  8. 7Difference-in-differencesBachelor's4 min
  9. 8DiD inferencePractice3 min
  10. 9Staggered adoptionMaster's4 min
  11. 10Honest parallel trendsPhD4 min
  12. 11Synthetic controlMaster's5 min
  13. 12Synthetic difference-in-differencesPhD3 min
  14. 13Panel dataMaster's4 min
  15. 14BoundsMaster's4 min
  16. Recap, problems, and the road aheadAll tracks3 min

Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.

Snow's Grand ExperimentBachelor's4 min

In the summer of 1854 cholera returned to London. The physician John Snow had argued for years that it spread through water contaminated by the evacuations of the sick, against the reigning theory that disease rose from miasma, bad air. That September he traced an outbreak in Soho to a single pump on Broad Street. But his strongest evidence came from south of the river. There, two companies supplied water. The Southwark and Vauxhall Company drew it from the Thames at Battersea, downstream of the city's sewer outfalls. The Lambeth Company, in 1852, had moved its intake upstream to Thames Ditton, above the reach of the tide and of London's sewage.

What made this a test was that the two companies had competed for customers street by street, in the 1840s, and their pipes ran side by side down the same roads. Which company supplied a house was decided long before, by a landlord or a previous tenant, Snow argued that this left neighbouring residents broadly comparable apart from their water supply; it was not an actual randomized assignment. So neighbours, rich and poor, breathing the same air, drew different water. Snow went house to house, through the first weeks of the epidemic, asking where the water came from in every house where someone had died. When residents did not know, he tested the water's salt content, which differed between the two sources.

Here is his Table Nine. In the forty thousand houses supplied by Southwark and Vauxhall, twelve hundred and sixty-three cholera deaths in the first seven weeks: three hundred and fifteen for every ten thousand houses. In the twenty-six thousand houses supplied by Lambeth, ninety-eight deaths: thirty-seven per ten thousand. In the rest of London, Snow printed fifty-nine. The counts imply about fifty-five and a half; we preserve the historical printing and flag its arithmetic error. Houses on the same streets, with the dirty water, had about eight point four times as many deaths per house, calculated from the counts. These are household-denominated death rates, not individual infection probabilities.

Snow saw what kind of evidence this was. "No fewer than three hundred thousand people of both sexes, of every age and occupation, and of every rank and station, were divided into two groups without their choice, and in most cases, without their knowledge." He called it a grand experiment. Nobody had flipped a coin. Snow argued that the history of the pipes made the supplied groups comparable; that causal interpretation still needs the design argument. That is a natural experiment: treatment that is as good as random, found rather than made. It convinced almost no one at the time. London did rebuild its sewers, after the Great Stink of 1858, but to remove the smell.

Part thirty-six adjusted for measured confounders, and asked how wrong an unmeasured one could make us. This part looks instead for a piece of the world that was randomized by accident, and asks how to read it. A lottery, or a birthday, that nudges some people into treatment: an instrument. A rule with a cutoff, such as a scholarship for a score of sixty: a discontinuity. A policy that starts in some places and not others: differences-in-differences, and its descendants.

Numbers: 315 vs 37 per 10,000 houses

1The credibility revolutionBachelor's3 min

In 1983 the econometrician Edward Leamer published a paper called Let's Take the Con out of Econometrics. His complaint was that the answer an observational regression gave depended on which control variables the analyst chose to include, and that the reported specification was one of many tried. The analyst chose after seeing the answers: the garden of forking paths of Part thirty-three. His proposed cure was to report how the estimate moved across all reasonable specifications. But his diagnosis stuck: few people took anyone else's observational regressions seriously.

The response, which Joshua Angrist and Jörn-Steffen Pischke named the credibility revolution in 2010, changed the question. The model-based approach of Part thirty-six adjusts for measured confounders and hopes nothing important is left out. The design-based approach looks first for variation in the treatment that is as good as random: a lottery, a birthday, a rule, a border. Then the analysis is a simple comparison, surrounded by checks that the design is what it claims. The argument moves from a model of the outcome to the design itself. Snow argued about how the pipes were laid, not about what made people sick.

This part covers four designs. An instrument: something as good as random, such as a draft lottery, that nudges some people into treatment. For a binary treatment, relevance, as-if random assignment, exclusion and monotonicity identify the effect for the compliers of Part thirty-five. Continuous treatments need a corresponding structural or marginal-effect interpretation. A discontinuity: a rule gives treatment above a cutoff. It assumes nothing else jumps at the cutoff, and identifies the effect for people near it. Differences-in-differences: a policy starts in some places and not others. It assumes the places would have moved in parallel, and identifies the effect on the treated. And the synthetic control: one treated unit, compared with a weighted mix of others that tracked it before.

The trade is always the same. Each design replaces unconfoundedness, which cannot be checked, with an assumption that is narrower and partly checkable. And each identifies a narrower effect: for the compliers, for people at the cutoff, for the places that were treated. Credibility is bought with generality, internal validity with external. Critics such as Angus Deaton have argued the price is sometimes too high. So the tools of Part thirty-five for transporting effects, and of Part thirty-six for sensitivity, still matter.

In 2021 the economics Nobel went to the movement. Half to David Card, for empirical contributions to labour economics, including the minimum-wage study of chapter seven. Half to Joshua Angrist and Guido Imbens, for methodological contributions to the analysis of causal relationships, including the local average treatment effect of Part thirty-five. We begin with the oldest of the designs, the instrument.

Numbers: four designs

2Instrumental variablesMaster's5 min

The idea first appears in an appendix to a 1928 book about tariffs on butter and flaxseed, by the economist Philip Wright, probably with help from his son Sewall, the inventor of path diagrams in Part thirty-six. Price and quantity are set together by supply and demand, so regressing one on the other estimates neither curve. But a variable that shifts supply without affecting demand, such as the weather where flax is grown, moves the market along the demand curve. The demand curve's slope is then the change in quantity divided by the change in price that the weather caused.

As a causal graph: an instrument Z, a treatment D, an outcome Y, and unmeasured confounders U of the treatment and the outcome. No adjustment can close the back door through U. The instrument instead needs three things. Relevance: it moves the treatment, which the data can check. Independence: it is as good as randomly assigned. Exclusion: it affects the outcome only through the treatment, with no arrow of its own and no path through U. That one cannot be checked. With effects that differ between people, Part thirty-five added monotonicity for binary treatment and found the complier average effect. With years of schooling, a continuous treatment, extra structural or weighted marginal-effect conditions are needed; the World uses a constant log-wage effect.

In 1991 Angrist and Alan Krueger found an instrument in the calendar. Children start school in the year they turn six, but may leave at sixteen, so those born early in the year are older when they start and reach the leaving age having done less school. The World's survey of two hundred thousand adults has the same rule. People born in the first quarter have about a seventh of a year less schooling than the rest. And their wages are about one percent lower. The World constructs quarter of birth independently and makes it affect wages only through schooling. In real data, birth season, family background and other channels make these assumptions substantive questions. Note how small these differences are; we will return to that.

With a binary instrument the estimate is a ratio, due to the statistician Abraham Wald. The first stage: being born in the first quarter changes schooling by minus years. The reduced form: it changes log wages by minus . If the instrument acts only through schooling, the wage change per year of schooling is their ratio, , and the World's truth is point zero seven five log points per year, about seven point eight percent. Ordinary least squares says , more than twice as much, because ability raises both schooling and wages.

With several instruments, the general recipe is two-stage least squares, two projections. First fit the treatment on the instruments, keeping only the part of schooling that the calendar explains. Then regress wages on that fitted part. The standard error must use the residuals with the actual schooling, not the fitted one; running the two stages by hand gets this wrong. With all three quarter indicators in the full survey, the estimate is , with a standard error of , and a first-stage F statistic of .

Angrist's earlier instrument, from 1990, was a real lottery. In the Vietnam era, birthdays were drawn at random to set the order of the draft. A low number made military service much more likely, so the lottery number is an instrument for being a veteran. The instrumental-variable analysis estimated that white men induced into service earned about fifteen percent less in the early nineteen-eighties than they would have without service. That effect belongs to the compliers, men who served because their number came up and otherwise would not have, not to volunteers or to those who avoided service anyway.

Numbers: Wald 0.0751 vs OLS 0.162

3Weak instrumentsMaster's4 min

The full survey has two hundred thousand people. A realistic study might have five thousand. In one such sample, the first-stage F statistic, which measures how strongly the instrument predicts schooling, is . Two-stage least squares says , with an interval from about zero to . Ordinary least squares says . With an instrument this weak, can the interval be trusted?

Draw a thousand such surveys from the World. The median first-stage F is , and in percent of surveys it is below ten. The estimates are centred near the truth, but their spread is enormous: the middle half runs from about one percent to twelve percent a year, and the tails reach far beyond the axes, in both directions. A weak instrument does not only make the estimate noisy. Its distribution is not normal, so the usual interval can mislead.

How badly depends on two things: the instrument's strength, measured by the concentration parameter mu squared, roughly the first-stage F minus one, and how strongly the treatment is confounded. Here is the true rejection rate of the nominal five percent test of the two-stage least squares estimate, with one instrument. With mild confounding the test is conservative. With moderate confounding it is about right. With strong confounding and a weak instrument it rejects a true null three times too often, and the estimate is pulled towards ordinary least squares. The World's survey sits near the middle line, which is why its single-instrument intervals were not far wrong.

Practice settled on a rule of thumb from Douglas Staiger and James Stock in 1997: worry if the first-stage F is below ten. Stock and Motohiro Yogo turned it into critical values that limit the bias or the size distortion, depending on the number of instruments. In 2022 David Lee, Justin McCrary, Marcelo Moreira and Jack Porter showed that ten is far too lenient for the usual interval: in their just-identified Gaussian weak-instrument approximation, using the usual one point nine six critical value at five percent regardless of endogeneity requires the F must exceed one hundred and four point seven. Their tF procedure adjusts the critical value to the observed F: at an F of ten, the t statistic must exceed three point four three.

The cure is older than the problem. In 1949, Theodore Anderson and Herman Rubin proposed testing each candidate value of the effect directly. Subtract the hypothesized effect of the treatment from the outcome, and regress what is left on the instruments. If the hypothesis is true, the instruments' coefficients are exactly zero, by the exclusion restriction, whatever their strength. With a valid constant-effect linear IV model and independent homoskedastic Gaussian errors conditional on the instruments and controls, the F test has exact size regardless of instrument strength. Heteroskedastic errors need a robust AR procedure. The confidence set is every value the test does not reject.

In our study of five thousand, the Anderson-Rubin p-value across candidate returns gives the set from about minus five percent to nineteen percent: wider than the two-stage interval. Across a thousand surveys, the set is an interval in three quarters of them. Otherwise it is two rays running off to infinity, or the whole real line. That is not a flaw. When the instrument barely moves the treatment, the data really cannot rule out much, and an interval that says so is telling the truth.

Numbers: median F 5.6; tF 104.7

4Many instruments; Mendelian randomizationMaster's4 min

To gain precision, Angrist and Krueger also interacted the quarter of birth with year and state of birth, up to a hundred and eighty instruments. In the World, interact quarter with region: thirty instruments, with real first- and second-quarter contrasts but no region-specific effects. In the full survey, two-stage least squares gives , with an F statistic of only , because the F is averaged over thirty instruments, most useless. The problem is that the first stage fits noise as well as signal, and the fitted noise in schooling is correlated with ability, the confounder, so it drags the estimate towards ordinary least squares.

Across a thousand surveys of five thousand, with thirty instruments, two-stage least squares clusters tightly, around . That is almost exactly where ordinary least squares sits. With many weak instruments the method collapses back into the bias it was meant to remove, and now it looks precise. Limited-information maximum likelihood, a close relative from 1949, often less median-biased under standard IV conditions, is closer to the truth here, with a much wider sampling distribution. No confidence interval is being certified by this histogram. The truth is point zero seven five log points per school year.

In 1995, John Bound, David Jaeger and Regina Baker did something devastating. They replaced the real quarters of birth with randomly generated ones, and reran the estimation. The new instruments are pure noise and cannot identify anything. Yet two-stage least squares still returned an estimate close to the original, with a respectable standard error. In the World, fake quarters interacted with region give , with a standard error of and an F of . With many irrelevant instruments, two-stage least squares can be pulled towards ordinary least squares. That is a finite-sample tendency, not an identity, and its conventional error can look reassuring. The first-stage F does.

Epidemiology found its own instruments in the genome. George Davey Smith and Shah Ebrahim named the idea Mendelian randomization in 2003. The alleles a person inherits are assigned at conception, by Mendel's lottery, independently of most later confounders. A variant that raises body mass index is an instrument for its effect on blood pressure. Genome-wide studies report, for each variant, its association with the exposure and with the outcome; the ratio of the two is a Wald estimate. The danger is pleiotropy: a gene that affects blood pressure through some other path breaks the exclusion restriction.

Forty simulated variants, ten of them with a direct effect on blood pressure, all in the same direction. The inverse-variance-weighted estimate fits a line through the origin: , pulled up by the pleiotropic variants. MR-Egger, proposed by Jack Bowden, Davey Smith and Stephen Burgess in 2015, allows an intercept. Its slope needs the InSIDE condition: direct effects independent of instrument strength, as well as adequate strength, summary-data assumptions and control of measurement error: slope , with a wider interval. Under those assumptions, the intercept estimates an average directional direct effect. It is not a test that rules out all pleiotropy. The truth is point three. MR-Egger replaces zero pleiotropy with different assumptions; it does not make every invalid instrument valid.

Numbers: 2SLS 0.147, LIML 0.091; Egger 0.267

5Regression discontinuityMaster's5 min

In 1960 the psychologists Donald Thistlethwaite and Donald Campbell studied the National Merit Scholarship programme, which gave certificates of merit to students who scored above a cutoff. A student who scored one point above the line is much like one who scored one point below, except that one got the certificate. So the jump in later outcomes at the line estimates the certificate's effect, for students at the line. The design was largely ignored for forty years, then revived by economists around 2000, when Jinyong Hahn, Petra Todd and Wilbert van der Klaauw set out its assumptions formally.

The World has a scholarship of its own: for ten years, every school-leaver who scored at least sixty on the final exam won a university scholarship. Forty thousand school-leavers, and their earnings at thirty. Each dot is the mean earnings for one point of the score. Blue below the cutoff, red above. Scholars earn thousand a year more than everyone else. But that compares strong students with weak ones. The design compares only those near the line, and asks how big the step is, right at sixty.

Formally: treatment is decided by the running variable, the score, crossing the cutoff c. Assume that the average potential outcomes, with and without the scholarship, have continuous conditional means at the cutoff, with no other discontinuous intervention. The World records scores in tenths, so applying continuous-score limit theory here also uses a local smoothness approximation. Then the effect at the cutoff is the difference between the two one-sided limits of the regression of the outcome on the score. No one at the cutoff is both treated and untreated: there is no overlap at all, so each side must be extrapolated to the line. Estimation is a problem at the boundary of the data.

The standard estimator is local linear regression: on each side of the cutoff, fit a straight line to the points within a bandwidth h, weighting them by a triangle that peaks at the cutoff. Our teaching plug-in follows the structure of Imbens and Kalyanaraman's 2012 bandwidth rule. It is not independently validated as their reference implementation or the exact finite-sample MSE optimum; here it is points. The jump between the two lines at sixty is thousand, with a standard error of . The World's truth is three. The earnings curve bends upward, and a straight line across thirty points cannot follow it to the edge. A local quadratic, with the same window, follows the bend: .

The choice of bandwidth is the choice of a bias-variance trade-off, Part twenty-nine's smoothing problem at a boundary. Here are the estimates at every bandwidth from three to thirty-five points, on all forty thousand school-leavers. A narrower window reduces smoothing bias but increases noise; it is not exactly unbiased. As the window widens it becomes precise and drifts away from the truth, and its interval drifts with it. The local quadratic stays near three much longer, at the price of width. A conventional interval at the mean-squared-error-optimal bandwidth is centred on a biased estimate by design: that bandwidth balances squared bias against variance, so bias remains material relative to the standard error under the usual leading-term expansion, even though its absolute size can vanish.

The arithmetic: the local linear estimate's bias grows like the square of the bandwidth, and its noise shrinks like one over the square root of n times h. The optimal bandwidth shrinks like n to the minus one fifth, and at it the bias stays half a standard deviation, however large the sample. Under this nonzero-curvature leading-term model, ignoring the bias gives asymptotic undercoverage. Sebastian Calonico, Matias Cattaneo and Rocio Titiunik's fix, in 2014, subtracts an estimate of the bias, using a local quadratic. And, crucially, widens the standard error to include the noise in that estimate. With the same bandwidth for both, the robust interval is exactly the local quadratic's estimate with its own standard error.

A single study of two thousand school-leavers. The conventional interval runs from to . The robust bias-corrected interval runs from to . It is wider, and centred somewhere else: the correction moves the estimate as well as widening the interval.

Numbers: 3.59 vs 2.99 (truth 3.0)

6RD validityPractice5 min

Is the discontinuity valid? One threat to the design is precise sorting across the cutoff, which can make potential-outcome means discontinuous there. Validity also needs consistency and exclusion of other discontinuous changes; no single sorting test establishes all of these. In a second version of the World's scholarship, teachers, knowing what is at stake, re-mark the scripts that fell just short. A third of the scripts scoring between fifty-six and sixty are found a few extra marks and pushed over the line. Now the students just above the line include weaker students who would have been below it.

Justin McCrary's test of 2008 looks for the fingerprint: a jump in the density of the running variable at the cutoff. It fits a smooth density on each side and compares the logs at the line. With honest marking this coarse histogram shows no clear jump. Scores are rounded to tenths; the continuous-density test here is a teaching approximation. After re-marking, a gap opens just below the line and a heap appears just above it. The estimated log jump is : almost three times as many scripts just above the line as just below, a z statistic of .

A second check: characteristics fixed before the exam should not jump at the line. In the World we can use aptitude itself. With honest marking, no jump. After re-marking, aptitude is lower just above the line, but only by a little: a z statistic of , which would not alarm most analysts. Only three and a half percent of students were moved. Yet the estimated effect of the scholarship falls to , from a truth of three. The density test shouted; the covariate test barely whispered.

Often the cutoff only changes the chance of treatment. In the World, eighty percent of those offered a scholarship take it up; and five percent of those below the line win one on appeal. The share with a scholarship jumps by at sixty, not by one. This is a fuzzy discontinuity. Comparing those who took a scholarship with those who did not gives a nonsensical thousand.

The fuzzy estimate divides the jump in outcomes by the jump in take-up: a Wald ratio, at the cutoff. Crossing the line is an instrument for the scholarship, but only right at the line. In the World the jump in earnings is , the jump in take-up , and their ratio , against a truth of three. With a nonzero first-stage jump, local exclusion, monotonicity and continuity assumptions, it identifies the effect for compliers at the cutoff: students who take a scholarship if and only if they are offered one.

The most famous discontinuity is political. David Lee, in 2008, took the vote margin in elections to the United States House of Representatives as the running variable. A party that barely won should be otherwise like one that barely lost, so the jump in its chance of winning the next election measures the advantage of incumbency. Devin Caughey and Jasjeet Sekhon found in 2011 that in the very closest post-war House races, incumbents won far more often than chance would allow, as if close contests could be nudged. Andrew Eggers and colleagues found that such sorting is rare in other countries and offices. The lesson is to check each application, not the design in general.

So every discontinuity should come with checks. The density of the running variable, smooth through the cutoff. Covariates fixed before treatment, with no jumps. Placebo cutoffs, at scores where nothing happens, with no effects. An answer that does not hinge on the bandwidth or the polynomial order, and never a global polynomial of high degree, which Andrew Gelman and Guido Imbens warned in 2019 can manufacture jumps. A donut can be a sensitivity check: dropping the nearest scores changes the extrapolation problem and may lose local identification. It does not automatically repair manipulation.

Numbers: McCrary z = 32; fuzzy 2.99

7Difference-in-differencesBachelor's4 min

Snow had a second argument, about time. In the epidemic of 1849, both companies drew their water from the tidal Thames in London. Lambeth moved its intake upstream in 1852. Between the two epidemics, cholera fell among Lambeth's customers and not among its rival's: a change compared with a change. The design's modern classic: on the first of April 1992, New Jersey raised its minimum wage from four dollars twenty-five to five dollars five. Neighbouring Pennsylvania did not. David Card and Alan Krueger surveyed four hundred and ten fast-food restaurants on both sides of the border, before the rise and eight months after.

Employment per restaurant, in full-time equivalents. In Pennsylvania, without the rise, it fell from twenty-three point three to twenty-one point two: a regional slump. In New Jersey, with the higher minimum wage, it rose slightly, from twenty point four to twenty-one point zero. Had New Jersey followed Pennsylvania's path, it would have ended near eighteen point three. The difference between the two changes is plus two point seven five employees per store. The estimated comparison is positive, conditional on the design assumptions; this is not a universal conclusion about every minimum-wage policy.

The estimator is the change among the treated minus the change among the controls. It assumes parallel trends: without the policy, the treated group's average untreated outcome would have changed by as much as the control group's did. With consistency, no anticipation and no relevant interference as well, the difference in differences identifies the average effect on the treated. The groups may differ in level, as New Jersey and Pennsylvania did; the levels cancel. Only the trends must agree. As a regression: a fixed effect for each unit, a fixed effect for each period, and the treatment indicator, which with two groups and two periods gives exactly the same number. With more periods and staggered adoption, chapter nine shows it does not.

Card and Krueger reported a difference of plus two point seven six, with a standard error of one point three six. It went against the textbook prediction that a price floor on labour reduces employment, and it caused an uproar. David Neumark and William Wascher, using payroll records instead of telephone surveys, found the opposite sign; Card and Krueger replied with official employment data of their own. But the design changed the nature of the argument. It was about which data and which comparison group, things anyone could check, not about whose model was right.

The World has a policy too. In 2009, of its two hundred towns adopted a jobs programme. towns never did. Their employment rates differ in level and share a common cycle. The World also knows what the 2009 towns would have done without the programme, the faint line: parallel to the never-treated towns, up to noise. Comparing 2009 to 2013 with 2008, the difference in differences is points; the truth for those years is .

An event study repeats the comparison for every year, always against the year before adoption, and plots the estimates against years since adoption. The leads, before 2009, check parallel trends: they should be zero. Here they wander a little below zero, within their bands, as two groups of towns with persistent shocks will. The lags show the programme's effect building by about point three a year. They track the truth. Note how wide the bands are, with only twenty comparison towns; chapter ten asks what a lead that is not quite zero should do to our conclusions.

Numbers: Card–Krueger +2.76

8DiD inferencePractice3 min

The hard part of differences-in-differences is the standard error. Here are six of the World's towns, their employment with the town and year effects taken out. The shocks persist: a good year tends to be followed by another. The correlation from one year to the next is . So twenty years of one town carry far less information than twenty independent observations, and a standard error that treats them as independent will be too small.

In 2004 Marianne Bertrand, Esther Duflo and Sendhil Mullainathan ran a devastating check, using wages of women in the Current Population Survey across fifty American states. They invented laws: chose states and years at random, pretended a law had passed, and estimated its effect by differences-in-differences, as the published studies did. The laws did not exist, so a five percent test should have found an effect five percent of the time. With the conventional standard errors, it found one about forty-five percent of the time.

Repeat it in the World. A thousand placebo laws, each passed in a random half of the towns in a random year, estimated with two-way fixed effects on the towns' untreated employment. With the ordinary least squares standard error, the test rejects percent of the time, almost exactly what Bertrand and her colleagues found. With standard errors clustered by town, which allow any correlation within a town over time, it rejects percent of the time. The honest standard error is times as large as the naive one.

The fixes are the ones Part twenty-three introduced. Cluster the standard errors by the unit at which the policy was assigned: the town, or the state. Or collapse each unit's data to one average before and one after, forming one change per unit instead of treating every year as an independent observation. With few treated clusters, ordinary cluster asymptotics can be unreliable. Some wild-bootstrap methods also fail in that setting; valid randomization inference needs a justified assignment mechanism, and placebo comparisons need exchangeability assumptions. With only one treated unit, inference requires additional design or structural assumptions. Chapter eleven uses placebo comparisons, whose validity also needs justification.

Numbers: placebo laws: 41% vs 5.5%

9Staggered adoptionMaster's4 min

Most real policies do not start everywhere at once. In the World's full rollout, towns adopt the jobs programme in 2004, in 2009, in 2014, and never do. Each coloured cell is a treated town-year. The programme's effect grows the longer a town has had it: workers are trained, firms move in. It grows faster in the early towns, which were keenest: seven tenths of a point a year, against three tenths and five hundredths. Averaged over all treated town-years, the true effect is points of employment.

For decades the standard analysis was the regression of chapter seven: town effects, year effects, and a treatment indicator. On the World's rollout it says minus , with a clustered standard error of . The truth is plus . A programme that raised employment in every town and every year it ran is estimated, confidently, to have lowered it. Every town has parallel trends, untreated outcomes satisfy parallel trends and there is no anticipation. The constant-effect regression does not identify the simple average ATT when effects evolve across cohorts and time.

Andrew Goodman-Bacon showed in 2021 what the regression actually does. Its coefficient is a weighted average of every simple two-by-two difference-in-differences between groups of towns that adopt at different times. Comparisons with the never-treated towns: good comparisons, positive. Early adopters against towns that have not adopted yet: also fine, positive. But also the later adopters against towns that already have the programme, using them as controls. Their outcomes are still rising, because their effect is still growing, so the later adopters look bad by comparison. These forbidden comparisons get almost half the weight, and they are strongly negative. The weighted sum is exactly the regression's minus .

Why the forbidden comparisons mislead: a two-by-two with already-treated towns as the control subtracts their change in outcomes. But their change includes the growth in their own treatment effect. So the comparison estimates the late towns' effect minus the change in the early towns' effect, which can be negative even when every effect is positive. Stable effects in the already-treated comparison group remove this changing-control contamination. Cohort weighting can still target a different average from the simple ATT. They rarely are. Clément de Chaisemartin and Xavier D'Haultfœuille showed the same thing in 2020: some treated units can even get negative weights.

The cure, discovered by several teams at once, is never to use already-treated units as controls. Brantly Callaway and Pedro Sant'Anna estimate a separate effect for each adoption cohort and each year, against the never-treated towns, then average them: , with an interval from to . Kirill Borusyak, Xavier Jaravel and Jann Spiess fit the town and year effects on untreated town-years only, impute what every treated town-year would have been, and average the differences: . Liyang Sun and Sarah Abraham fix the event study by interacting it with cohort. The two estimates computed here land near the truth; the Sun-Abraham alternative is described rather than fitted. The true average is .

The event-study version of the regression suffers too. Its coefficients mix effects from other years and cohorts, as Sun and Abraham showed. Here it shows leads well above zero, a pre-trend that does not exist, and lags that are too small. The Callaway and Sant'Anna estimates by event time sit close to zero before adoption, and follow the truth after it, which keeps rising because the early towns dominate the later years.

Numbers: TWFE −0.49 vs truth 3.96

10Honest parallel trendsPhD4 min

Common practice treats the leads of an event study as a test: if none is significantly different from zero, assume parallel trends and move on. Jonathan Roth showed in 2022 that these pre-tests often have little power against violations large enough to matter. Worse, reporting only the studies that pass them distorts what gets reported, Part thirty-three's selection again. The better approach is to say how far from parallel the trends might plausibly be, and carry that uncertainty into the conclusion.

A seeded example, with a hundred and fifty towns that adopt a programme in 2010, chosen because they were already improving, and a hundred and fifty that never adopt. Their untreated employment rises two tenths of a point a year faster. The leads show it: a steady climb towards zero. The programme adds exactly one point from adoption on. But the first-year estimate is , and the lags keep climbing, because the pre-existing trend is read as effect. The conventional interval excludes the truth.

Ashesh Rambachan and Jonathan Roth's framework, published in 2023, writes the population event-study coefficient as the effect plus the violation of parallel trends. Estimates add sampling error, correlated across event times. Before adoption there is no effect, so the leads estimate the violation directly. Then they restrict how the violation may continue after adoption. Our simplified first-post-period model bounds departure from a fitted population linear pre-trend by M. It illustrates sensitivity but differs from their full smoothness-restriction procedure. Under relative magnitudes, the jump after adoption is at most M-bar times the largest jump seen before it. We account for the full joint covariance in the linear extrapolation, and use simultaneous pre-jump bounds for the relative-magnitude interval. These are asymptotic intervals under the stated teaching restrictions.

For the first year after adoption. On the left, in red, the conventional interval, which misses the truth. With M equal to zero, the violation is assumed to continue the linear pre-trend exactly. Subtracting it gives , with an interval that covers the truth of one. Allowing the trend to bend by up to M widens the set, in gold, and its interval, in green. The conclusion that the programme helped survives until M is about , a departure from this particular linear extrapolation. Its scale and interpretation depend on the restriction being imposed. That breakdown value is what a reader needs in order to judge.

Under relative magnitudes, the largest year-to-year change in the leads is . If the violation can jump after adoption by half that, or by as much, the effect is clearly positive. Even if it can jump by twice the largest change seen before, the interval stays above zero, from . The post-treatment restrictions cannot be verified from pre-treatment outcomes alone; the point is to make the assumption explicit, and to let a reader with a different view recompute the answer.

Parallel trends is an assumption about what would have happened. The leads inform it; they cannot prove it. So report the event study, the sensitivity sets, and the breakdown value, the departure at which the conclusion changes. It is the same spirit as the E-values and robustness values of Part thirty-six. Next: what to do when only one unit was treated, and there are many possible controls.

Numbers: 1.17 → 0.97; breakdown 0.87 under the teaching bound

11Synthetic controlMaster's5 min

In November 1988, California's voters passed Proposition 99. From January 1989, every pack of cigarettes carried twenty-five cents more tax, and the money paid for anti-smoking campaigns and research. Did it reduce smoking? There is one treated state. Differences-in-differences needs a comparison group whose trend California would have followed; which state, or which mixture of states, is California without the law? Alberto Abadie and Javier Gardeazabal's answer, first used in 2003 for the economic cost of terrorism in the Basque Country, was to build one. Abadie, Alexis Diamond and Jens Hainmueller applied it to Proposition 99 in 2010.

Cigarette sales per person, 1970 to 2000. California in red. In blue, the average of the thirty-eight states that did not run large tobacco-control programmes in the period. California was already lower, and falling faster, long before 1989. A difference-in-differences against the average would credit the law with California's existing decline.

The recipe: choose weights on the other states, non-negative and adding to one, so that the weighted average tracks California's sales as closely as possible before the law. After the law, the same weighted average is the synthetic California, the estimate of what California would have done without it. The effect in each year is the gap between the two. Because the weights are convex, the synthetic control interpolates among real states and never extrapolates beyond them, and usually only a few states get any weight, so anyone can inspect the comparison. Abadie's version also matches covariates; ours matches the sales path alone.

The weights that track California best: Utah , Montana , Nevada , Connecticut , New Hampshire a little. Abadie and his colleagues found a similar mix. Before 1989, the synthetic California follows the real one within about one and a half packs a year. After 1989, they part: real California's sales fall much faster than its synthetic twin's.

The gap between them is the estimated effect, year by year. Before 1989 it hovers near zero, as the weights were chosen to make it. After the law it opens steadily, reaching fewer packs per person by 2000, nearly two fifths of the sales California would have had. Averaged over the twelve years, packs per person per year.

With one treated state, there is no standard error in the usual sense. Abadie's answer is a placebo test: pretend, in turn, that each of the other thirty-eight states had passed the law in 1989, build its synthetic control, and look at its gap. Treating those ranks as a randomization p-value requires exchangeability of the treated-state assignment under the null; observational placebos alone do not guarantee it. Ranked by how much the fit worsens after 1989 relative to before, California comes of , a p-value of . Missouri and Virginia, whose synthetic controls fitted almost perfectly before 1989, edge ahead of it. Restricting the reference set to states whose pre-treatment root mean squared error is no more than twice California's leaves twenty-nine states, California included. Its post-to-pre error ratio is still third, giving three over twenty-nine, about point one zero. This descriptive filter changes the reference comparison; it does not turn it into a randomized design. The permutation analogy is Part sixteen applied to places, with an assignment or exchangeability assumption. Filtering by pre-fit changes the reference set and must be disclosed.

The method's assumptions. It needs a long pre-period: a close fit over a few years can be luck, while one over nineteen years, through booms and recessions, is harder to fake. It needs the treated unit to lie within the range of the donors; a state more extreme than all others cannot be synthesized. It assumes the law did not spill over: if Californians drove to Nevada for cigarettes, Nevada's sales, and the synthetic California, would rise. And it still assumes that a mixture that tracked California before would have kept tracking it, without the law.

Numbers: −26.6 packs in 2000

12Synthetic difference-in-differencesPhD3 min

Differences-in-differences and the synthetic control look like rivals, but they are two corners of one idea. DiD weights all control units equally and all pre-periods equally, and asks only that the average trend be parallel. The synthetic control chooses unit weights to match the treated unit's levels, and then compares levels directly. In 2021, Dmitry Arkhangelsky, Susan Athey, David Hirshberg, Guido Imbens and Stefan Wager combined them: choose unit weights, as the synthetic control does, but match trends rather than levels; and choose weights for the pre-periods too, emphasizing the years that look most like the post-period.

The unit weights solve a synthetic-control problem with two changes: an intercept, so that the weighted controls need only run parallel to California, not at the same level; and a small ridge penalty, which spreads the weight over more states. The time weights do the same across years: they find the mix of pre-period years whose outcomes best predict the controls' post-period average. The estimate is then a difference-in-differences, weighted both ways. With one treated unit, the standard error comes from placebos: pretend each control state was treated, re-estimate, and take the spread. Interpreting this as sampling uncertainty requires comparable untreated-state shocks and the relevant model conditions; a single treated state does not supply unrestricted cluster asymptotics.

For Proposition 99, the synthetic DiD unit weights, in green, are spread over states, led by Nevada, New Hampshire, Connecticut and Delaware. The synthetic control's weights, in blue, concentrate on a few: Utah, Montana and Nevada. The time weights fall entirely on the last three years before the law, 1986 to 1988: the years most like what came after.

The three estimates of the law's average effect, per person per year, from 1989 to 2000. Plain difference-in-differences: minus packs, with a placebo standard error of about seventeen; it credits the law with California's earlier decline. The synthetic control: minus . Synthetic DiD: minus , with the smallest standard error. The statistics kit reproduces the paper's estimates to the decimal; our placebo standard errors are close to theirs.

In the paper's simulations, built on real panel data, synthetic DiD was rarely far behind the better of the other two and often ahead of both. But with one treated state, every estimate lies within two standard errors of every other. The point estimates suggest lower cigarette sales under the fitted counterfactual models. Fifteen to twenty-five packs describes the approximate range of these point estimates, not a confidence interval. Sampling uncertainty is much wider, and causal attribution needs assumptions about comparable trends, other policies and spillovers. Next, panels with many units, and what their fixed effects do and do not remove.

Numbers: −15.6 / −19.5 / −27.3

13Panel dataMaster's4 min

With repeated observations of the same units, a panel, every unit can carry its own intercept alpha i: a time-invariant additive contribution to the outcome. Nonadditive unit heterogeneity is not generally removed by one intercept. Subtracting each unit's own average removes it. Only changes within a unit identify the effect. By the Frisch-Waugh-Lovell theorem of Part twelve, this is exactly ordinary least squares with a dummy variable for every unit. And Yair Mundlak showed in 1978 that adding each unit's average of x as a regressor gives the same slope, which links fixed effects to the random-effects models of Part twenty-five.

A seeded panel: three hundred units, eight periods, and an x that is correlated with each unit's fixed characteristic, which also raises y. Pooled least squares, ignoring the units, says , nearly double the truth. The within estimator, three hundred dummies, and Mundlak's regression all give the same number, , to the last decimal. The truth is one.

Fixed effects remove confounders that do not change. Anything that changes over time within a unit, and drives both x and y, remains. They amplify measurement error: if x barely changes within units, most of the change that remains is noise, and the slope is attenuated, Part twenty-three's errors in variables. They need strict exogeneity: the errors in any period must be unrelated to x in every period, so feedback from outcomes to later treatment breaks them. And with the lagged outcome as a regressor, they are biased by construction.

In a dynamic panel, this year's outcome depends on last year's, and on a unit effect. Demeaning subtracts each unit's average, and that average contains this year's error, so the demeaned lagged outcome is correlated with the demeaned error. Stephen Nickell showed in 1981 that the bias does not vanish as the number of units grows. It is roughly minus one plus rho, over T minus one. With rho a half and five periods, the formula predicts the fixed-effects estimate will converge to , not to point five.

Five hundred simulated panels of five hundred units and five periods. The fixed-effects estimates cluster tightly around , exactly where Nickell's formula says, , and nowhere near the truth. The large sample makes the wrong answer precise. The estimator of Theodore Anderson and Cheng Hsiao, from 1981, is centred on the truth, at the price of three times the spread.

The fix uses an instrument. First-difference the model, which also removes the unit effect. The differenced lag is correlated with the differenced error, but with serially uncorrelated idiosyncratic errors and the required initial-condition moments, the outcome two periods back is uncorrelated with that differenced error, so it can serve as an instrument: Anderson and Hsiao. Manuel Arellano and Stephen Bond, in 1991, used all the earlier lags at once, by the generalized method of moments. And the number of instruments then grows with the number of periods, which brings back chapter four: with too many, the estimate drifts back towards the biased one.

Numbers: Nickell: 0.170 for 0.5

14BoundsMaster's4 min

Charles Manski's starting point, in 1990, was to ask what the data say with no assumptions at all. Suppose an outcome is missing for some people. Its mean is a mixture of the mean among those observed and among those missing. The data say nothing about the missing, except that a yes-or-no outcome lies between zero and one. So the mean lies in an interval: the worst case, where every missing person scored zero, and the best, where every one scored one. Its width is the share missing. It does not shrink as the sample grows; a smaller missing share or stronger justified assumptions can narrow it.

A seeded example: a randomized training programme for four thousand workers, with employment measured by a follow-up survey. The survey reaches percent of the trained and percent of the others. With no assumption about the people it missed, the effect on employment lies between minus and : a width of a half, the two missing shares added. The data cannot even sign the effect. Here, as it happens, the respondents give nearly the right answer, but nothing in the data could have told us so.

A harder problem: the effect of training on wages. Wages exist only for people who are employed: percent of the trained, percent of the others. Randomization balanced the groups, but employment did not. Training draws marginal workers into jobs, and they earn little. So comparing the wages of the employed gives plus dollars an hour, though for the workers who would be employed either way the effect is a full dollar. The comparison is not of like with like.

In this randomized experiment, David Lee's 2009 bounds additionally assume that training never stops anyone working, with consistent treatment and well-defined selection and wage outcomes. Then the employed trained workers are the always-employed plus some marginal workers, and the employed controls are the always-employed alone. The share of employed trained workers who are marginal is the difference in employment rates, divided by the trained rate. We do not know which ones they are. In the worst case they are the highest earners; in the best, the lowest. So trim that share from the top, and then from the bottom, of the trained workers' wages. The two trimmed means, minus the controls' mean, bound the effect for the always-employed.

In the example, percent of the employed trained workers are marginal. Trimming gives bounds from minus to plus dollars an hour. The truth, one dollar, lies inside. They are wide, because the marginal workers are a large share and could be anywhere in the distribution. Valid covariate-conditional selection restrictions can sharpen population bounds, although finite-sample estimated bounds need not always narrow, and so do further assumptions about who is marginal; each assumption buys width.

Manski summarized the trade in what he called the law of decreasing credibility: the credibility of inference decreases with the strength of the assumptions maintained. Every design in this part made that trade: a stronger assumption, a sharper answer, and fewer people who believe it. Bounds draw the line between what the data show and what the assumptions add, and that line is worth showing even when one goes beyond it.

Numbers: Manski [−0.15, 0.34]; Lee [−0.99, 1.40]

Recap, problems, and the road aheadAll tracks3 min

Part thirty-seven in twelve lines. Snow's two water companies ran down the same streets, and the contaminated-water group had about eight times as many deaths per house. The credibility revolution put the design before the regression. An instrument identifies an effect by a Wald ratio, or two-stage least squares, if it reaches the outcome only through the treatment. Weak instruments make the usual interval unreliable, and the Anderson-Rubin set is valid regardless of strength under its stated linear-IV and error-distribution assumptions. Many instruments drag two-stage least squares back to ordinary least squares, while limited-information maximum likelihood resists, and genes can serve as instruments if they act through one path. Regression discontinuities compare people at a cutoff, with local fits and robust bias correction, and must be checked for sorting. Differences-in-differences assume parallel trends, and need standard errors clustered by the unit of treatment. With staggered adoption, two-way fixed effects can get the sign wrong, and estimators such as Callaway and Sant'Anna or imputation target explicit effects under their own identification conditions. Honest parallel trends carry doubt about the trends into the interval; synthetic controls and synthetic DiD build the comparison. Fixed effects remove what is fixed, and dynamic panels need instruments. And bounds show what the data say before the assumptions speak.

A promise for later. This part estimated causal effects from natural experiments. It assumed that each design's key assumption held, and it met serial correlation only as a nuisance for standard errors. Part thirty-eight takes time seriously: long memory, unit roots, volatility that moves, and states that can only be inferred.

Where it comes back. Part 38 studies the persistence that made placebo laws so dangerous. Part 39 handles spillovers across space. Part 41 returns to selection, with Heckman's model, and to measurement error. Part 47 derives weak-instrument asymptotics. Part 49 finds the influence functions behind these estimators. Part 52 treats many instruments as a high-dimensional problem. Part 57 makes permutation inference rigorous. Part 60 asks when an effect found in one place holds in another. And Part 62 takes partial identification and sensitivity to the frontier.

Six problems, with full solutions in the README. The Wald ratio as two-stage least squares; why the Anderson-Rubin test is immune to weak instruments; the optimal bandwidth and its built-in bias; two-way fixed effects in the two-by-two case; Nickell's bias with two periods; and Manski's bounds. Pause here if you want to try them.

The books this part follows: Angrist and Pischke's Mostly Harmless Econometrics; Scott Cunningham's Mixtape and Nick Huntington-Klein's The Effect; Cattaneo, Idrobo and Titiunik on regression discontinuity; and Manski on partial identification; with the papers from Snow to Rambachan and Roth.

Thirty-seven parts of sixty-five. When the world runs an experiment by accident, we can read it, if we check the design as carefully as the estimate. Next, Harold Hurst measures the Nile, and finds a memory that lasts for centuries. Part 38: time series in depth.

Where it goes next. The serial correlation behind the placebo laws becomes the subject of Part 38; selection and measurement error return in Part 41; weak-instrument asymptotics are derived in Part 47, the influence functions of these estimators in Part 49, and partial identification goes to the frontier in Part 62.

Key results

The part's results in one place, for revision.

The Wald ratio\(\displaystyle \beta_{\text{IV}}=\frac{\operatorname{Cov}(Y,Z)}{\operatorname{Cov}(D,Z)}=\frac{E[Y\mid Z=1]-E[Y\mid Z=0]}{E[D\mid Z=1]-E[D\mid Z=0]}\)
Sharp regression discontinuity\(\displaystyle \tau_{\text{RD}}=\lim_{x\downarrow c}E[Y\mid X=x]-\lim_{x\uparrow c}E[Y\mid X=x],\qquad\allowbreak h_{\text{MSE}}\propto n^{-1/5}\)
Difference-in-differences\(\displaystyle \hat\tau=(\bar Y_{1,\text{post}}-\bar Y_{1,\text{pre}})-(\bar Y_{0,\text{post}}-\bar Y_{0,\text{pre}})\)
Goodman-Bacon decomposition\(\displaystyle \hat\beta_{\text{TWFE}}=\sum_k w_k\,\hat\beta_k^{2\times 2},\qquad\allowbreak w_k\ge 0,\ \sum_k w_k=1\)
Nickell's bias with two periods\(\displaystyle \operatorname{plim}_{N\to\infty}\hat\rho_{\text{FE}}-\rho=-\tfrac{1+\rho}{2}\)
Manski's bounds, outcomes in [0, 1]\(\displaystyle \text{width}=(1-r_1)+(1-r_0),\qquad\allowbreak r_a=\text{response }\allowbreak \text{rate }\allowbreak \text{in }\allowbreak \text{arm }a\)

Try it

Lab 37 · Staggered adoption: the regression that gets the sign wrong

Draw the World's rollout (200 towns adopt a jobs programme in 2004, 2009, 2014 or never, with effects that grow), fit the two-way fixed-effects regression, decompose it into Goodman-Bacon's two-by-two comparisons, and compare it with Callaway and Sant'Anna's estimator and with a world where the effect is constant.

Figure produced by Lab 37: Staggered adoption: the regression that gets the sign wrong
Produced by the lab below, seed 0, in 0.2 s.
python -m videos.stats.labs 37 needs numpy, scipy, matplotlib · download lab37.py · source on GitHub
true ATT over treated town-years             3.96
TWFE coefficient (clustered SE)              -0.57 (0.21)
  2x2s, vs never                             weight 0.25, average +2.65
  2x2s, early vs later                       weight 0.30, average +2.34
  2x2s, later vs earlier                     weight 0.45, average -4.23
  weighted sum of the 2x2s                   -0.57
Callaway-Sant'Anna (90% CI)                  3.85 (3.56 to 4.14)
imputation estimator                         3.88
constant effect 2: TWFE, Callaway-Sant'Anna  1.90, 1.89

With growing effects the later-versus-earlier comparisons subtract the early towns' rising effect, carry almost half the weight and drag the regression below zero; with a constant effect the same regression is fine.
The code (79 lines; it asserts its own result)
"""Lab 37: run two-way fixed effects on a staggered rollout, take its coefficient apart, and repair it."""

import numpy as np

from videos.coursekit import labs
from explainer.stats.kit import quasi
from explainer.stats.world import World

TITLE = "Staggered adoption: the regression that gets the sign wrong"
GOAL = ("Draw the World's rollout (200 towns adopt a jobs programme in 2004, 2009, 2014 or never, with effects that "
        "grow), fit the two-way fixed-effects regression, decompose it into Goodman-Bacon's two-by-two comparisons, "
        "and compare it with Callaway and Sant'Anna's estimator and with a world where the effect is constant.")
TASKS = [
    "Make every cohort's effect grow at the same rate (edit tau so each slope is 0.3). Is TWFE still negative, and why not?",
    "Drop the 20 never-treated towns before fitting. Which estimators still run, and what does TWFE become?",
    "Use quasi.event_study on the panel and compare its leads (event times below 0) with callaway_santanna's 'event' entries.",
]


def run(seed=0):
    rng = np.random.default_rng(seed)
    p = World.rollout_panel(rng)
    Y, D, G, years, att = p["y"], p["D"], p["G"], p["years"], p["att"]
    tw = quasi.twfe(Y, D)
    cs = quasi.callaway_santanna(Y, G, years)
    imp = quasi.imputation(Y, G, years)
    parts = quasi.bacon(Y, G, years)
    kinds = ("vs never", "early vs later", "later vs earlier")
    w = {k: sum(o["w"] for o in parts if o["kind"] == k) for k in kinds}
    est = {k: sum(o["w"] * o["est"] for o in parts if o["kind"] == k) / w[k] for k in kinds}
    total = sum(o["w"] * o["est"] for o in parts)
    # the same towns, shocks and adoption dates, but an effect of 2 for every treated town-year
    Yc = p["y0"] + 2.0 * D
    tw_c, cs_c = quasi.twfe(Yc, D), quasi.callaway_santanna(Yc, G, years)

    lab = labs.Lab()
    lab.row("true ATT over treated town-years", f"{att:.2f}")
    lab.row("TWFE coefficient (clustered SE)", f"{tw['beta']:.2f} ({tw['se']:.2f})")
    for k in kinds:
        lab.row(f"  2x2s, {k}", f"weight {w[k]:.2f}, average {est[k]:+.2f}")
    lab.row("  weighted sum of the 2x2s", f"{total:.2f}")
    lab.row("Callaway-Sant'Anna (90% CI)", f"{cs['att']:.2f} ({cs['ci'][0]:.2f} to {cs['ci'][1]:.2f})")
    lab.row("imputation estimator", f"{imp['att']:.2f}")
    lab.row("constant effect 2: TWFE, Callaway-Sant'Anna", f"{tw_c['beta']:.2f}, {cs_c['att']:.2f}")
    lab.note = ("With growing effects the later-versus-earlier comparisons subtract the early towns' rising effect, "
                "carry almost half the weight and drag the regression below zero; with a constant effect the same "
                "regression is fine.")

    assert abs(total - tw["beta"]) < 1e-8, "the decomposition reproduces the regression exactly"
    assert tw["beta"] < 0 and att - tw["beta"] > 3, "TWFE is negative though every effect is positive"
    assert est["later vs earlier"] < 0 < min(est["vs never"], est["early vs later"]) and w["later vs earlier"] > 0.4
    assert abs(cs["att"] - att) < 4 * cs["se"] and abs(imp["att"] - att) < 0.6, "the repaired estimators find the ATT"
    assert abs(tw_c["beta"] - 2) < 0.4 and abs(cs_c["att"] - 2) < 0.5, "a constant effect breaks nothing"

    fig, ax = labs.figure(2, size=(11, 4.2))
    cohorts = [(2004.0, labs.BLUE, "adopt 2004"), (2009.0, labs.GOLD, "adopt 2009"), (2014.0, labs.GREEN, "adopt 2014"),
               (np.inf, labs.GREY, "never")]
    for g, color, name in cohorts:
        k = G == g
        ax[0].plot(years, Y[k].mean(0), color=color, label=name)
        if np.isfinite(g):
            ax[0].axvline(g - 0.5, color=color, lw=0.8, ls=":")
    ax[0].set(title="Mean employment rate by adoption cohort", xlabel="year", ylabel="employment rate (%)")
    ax[0].set_xticks(years[::4])
    ax[0].legend()
    names = ["truth", "TWFE", "vs never", "early vs\nlater", "later vs\nearlier", "Callaway-\nSant'Anna", "imputation"]
    vals = [att, tw["beta"], est["vs never"], est["early vs later"], est["later vs earlier"], cs["att"], imp["att"]]
    colors = [labs.GREY, labs.RED, labs.BLUE, labs.BLUE, labs.ORANGE, labs.GREEN, labs.GREEN]
    ax[1].bar(range(len(vals)), vals, color=colors, width=0.7)
    for i, v in enumerate(vals):
        ax[1].text(i, v + (0.15 if v >= 0 else -0.15), f"{v:.2f}", ha="center", va="bottom" if v >= 0 else "top", fontsize=9)
    ax[1].axhline(0, color=labs.MUTED, lw=0.8)
    ax[1].set_axisbelow(True)
    ax[1].set_xticks(range(len(vals)))
    ax[1].set_xticklabels(names, fontsize=8)
    ax[1].set_ylim(min(vals) - 0.9, max(vals) + 0.9)
    ax[1].set(title="TWFE (red) averages three kinds of 2x2", ylabel="effect (points of employment)")
    lab.fig = fig
    return lab

Now change it

  1. Make every cohort's effect grow at the same rate (edit tau so each slope is 0.3). Is TWFE still negative, and why not?
  2. Drop the 20 never-treated towns before fitting. Which estimators still run, and what does TWFE become?
  3. Use quasi.event_study on the panel and compare its leads (event times below 0) with callaway_santanna's 'event' entries.

Problems, with solutions

Try each problem before opening its solution.

  1. Wald = 2SLS. With a binary instrument, show that 2SLS equals the Wald ratio \(\frac{E[Y|Z=1]-E[Y|Z=0]}{E[D|Z=1]-E[D|Z=0]}\).

    Solution

    With Z binary and a constant, the first stage fits D̂ = E[D | Z]. Then cov(Y, Z)/cov(D, Z) = (E[Y | Z=1] − E[Y | Z=0])/(E[D | Z=1] − E[D | Z=0]), because cov(V, Z) = Var(Z)(E[V | Z=1] − E[V | Z=0]) for any V.

  2. AR is robust. Show that under \(H_0: \beta = b_0\) the Anderson–Rubin statistic's distribution does not depend on the first stage.

    Solution

    Under H₀, Y − b₀D = Wγ + u with u independent of Z (exclusion and independence).

    • The regression of Y − b₀D on (W, Z) has instrument coefficients exactly zero.
    • With independent homoskedastic Gaussian errors conditional on the valid instruments and exogenous controls, the F statistic is exactly F(q, n − k); the first stage never enters. Mere marginal normality is insufficient. A heteroskedastic model needs robust AR inference.
  3. The MSE bandwidth. Local linear RD: bias \(\approx B h^2\), variance \(\approx V/(nh)\). Find \(h_{\text{MSE}}\), and show bias/SD \(= \frac12\) there.

    Solution

    MSE(h) = B²h⁴ + V/(nh). Setting the derivative 4B²h³ − V/(nh²) to zero gives h = (V/(4B²n))^{1/5} ∝ n^{−1/5}.

    • In this leading-term, nonzero-curvature approximation, B²h⁴ = V/(4nh), so bias² = variance/4 and absolute bias/SD = ½. Absolute bias can tend to zero while remaining material relative to the standard error.
  4. TWFE in the 2×2. Show that with two groups and two periods, the TWFE coefficient equals the difference in differences.

    Solution

    With two units, or groups, and two periods, the two-way demeaned treatment is ±¼.

    • The regression coefficient is then the double difference of the four means.
  5. Nickell with two periods. For \(y_{it} = \rho y_{i,t-1} + \alpha_i + \varepsilon_{it}\) with two usable periods, show FE converges to \(\rho - (1+\rho)/2\).

    Solution

    With observations y₀, y₁, y₂, fixed effects equals first differences: Δy₂ on Δy₁.

    • plim = ρ + cov(Δy₁, Δε₂)/var(Δy₁) = ρ − σ²/(2σ²/(1 + ρ)) = ρ − (1 + ρ)/2.
    • This matches nickell_bias(ρ, 2).
  6. Manski. Derive Manski's bounds on \(E[Y(1)] - E[Y(0)]\) for \(Y \in [0,1]\) with response rates \(r_1, r_0\); show the width is \(2 - r_1 - r_0\).

    Solution

    Let E[Y(1)] ∈ [r₁ȳ₁, r₁ȳ₁ + 1 − r₁] and E[Y(0)] ∈ [r₀ȳ₀, r₀ȳ₀ + 1 − r₀].

    • The difference lies between the lower end of the first minus the upper end of the second, and the reverse.
    • The width is (1 − r₁) + (1 − r₀) = 2 − r₁ − r₀. Causal interpretation also needs random treatment or other identification of the arm means. These plug-in endpoints are not confidence limits.

Notes and sources

Where it comes back

  • Part 38: persistence and unit roots.
  • Part 39: spillovers across space.
  • Part 41: selection and measurement error.
  • Part 47: weak-instrument asymptotics.
  • Part 49: influence functions for DiD and IV estimators.
  • Part 52: many instruments as a high-dimensional problem.
  • Part 57: permutation inference.
  • Part 60: external validity and distribution shift.
  • Part 62: partial identification, sensitivity and surrogates.

Glossary

  • Natural experiment: variation in treatment that is as good as random, found rather than made.
  • Instrument; exclusion; relevance: a variable that moves the treatment and reaches the outcome only through it.
  • First stage; reduced form; Wald ratio; 2SLS: the instrument's effects on treatment and on outcome; their ratio; its general form.
  • Weak instruments; F; tF; Anderson–Rubin: instruments that barely move the treatment; the diagnostic; the adjusted critical value; the test that needs no strength.
  • LIML: a k-class estimator often less median-biased under standard weak/many-instrument conditions; this is not a universal finite-sample guarantee.
  • Mendelian randomization; pleiotropy; MR-Egger: genes as instruments; genes acting through other paths; the intercept allowing average directional pleiotropy under InSIDE and additional strength/measurement-error conditions.
  • Regression discontinuity (sharp, fuzzy); running variable; bandwidth: treatment by a cutoff in a score.
  • Robust bias correction: subtracting the estimated smoothing bias, with an SE that includes its noise.
  • McCrary test; donut: a jump in the running variable's density; dropping the points nearest the cutoff.
  • Difference-in-differences; parallel trends; event study: two changes subtracted; the assumption; one DiD per period around adoption.
  • Placebo laws; clustered SEs: invented policies for checking a test's size; SEs that allow correlation within units.
  • Staggered adoption; forbidden comparison; Goodman-Bacon decomposition: treatment at different times; already-treated units used as controls; TWFE as a weighted average of 2×2s.
  • Callaway–Sant'Anna; imputation estimator: estimators that compare only with untreated cells.
  • Honest DiD; breakdown value: inference allowing bounded violations of parallel trends; the violation at which a conclusion changes under a specified restriction. The teaching linear-extrapolation bound differs from the full Delta-SD framework.
  • Synthetic control; SDID: a convex combination of controls matching the treated unit; with intercepts and time weights.
  • Fixed effects; within transformation; Nickell bias; Anderson–Hsiao: unit intercepts; demeaning; the dynamic-panel bias; differencing with lagged instruments.
  • Partial identification; Manski bounds; Lee bounds; law of decreasing credibility: what the data imply without assumptions, and the trade between assumptions and credibility.

Sources

  • Snow and the revolution.
    • J. Snow, On the Mode of Communication of Cholera (2nd ed., 1855).
    • E. Leamer, AER 73 (1983); J. Angrist & J.-S. Pischke, JEP 24 (2010), Mostly Harmless Econometrics (2009).
  • Instruments.
    • P. Wright, The Tariff on Animal and Vegetable Oils (1928); T. Anderson & H. Rubin, Ann. Math. Stat. 20 (1949).
    • J. Angrist, AER 80 (1990); J. Angrist & A. Krueger, QJE 106 (1991); J. Bound, D. Jaeger & R. Baker, JASA 90 (1995).
    • D. Staiger & J. Stock, Econometrica 65 (1997); J. Stock & M. Yogo (2005); D. Lee, J. McCrary, M. Moreira & J. Porter, AER 112 (2022).
  • Mendelian randomization. G. Davey Smith & S. Ebrahim, Int. J. Epidemiol. 32 (2003); J. Bowden, G. Davey Smith & S. Burgess, Int. J. Epidemiol. 44 (2015).
  • Regression discontinuity.
    • D. Thistlethwaite & D. Campbell, J. Educ. Psychol. 51 (1960); J. Hahn, P. Todd & W. van der Klaauw, Econometrica 69 (2001).
    • G. Imbens & K. Kalyanaraman, REStud 79 (2012); S. Calonico, M. Cattaneo & R. Titiunik, Econometrica 82 (2014).
    • J. McCrary, J. Econometrics 142 (2008); D. Lee, J. Econometrics 142 (2008).
    • D. Caughey & J. Sekhon, Political Analysis 19 (2011); A. Eggers et al., AJPS 59 (2015); A. Gelman & G. Imbens, JBES 37 (2019).
  • Difference-in-differences.
    • D. Card & A. Krueger, AER 84 (1994), 90 (2000); D. Neumark & W. Wascher, AER 90 (2000).
    • M. Bertrand, E. Duflo & S. Mullainathan, QJE 119 (2004).
    • A. Goodman-Bacon, J. Econometrics 225 (2021); C. de Chaisemartin & X. D'Haultfœuille, AER 110 (2020).
    • B. Callaway & P. Sant'Anna, J. Econometrics 225 (2021); L. Sun & S. Abraham, J. Econometrics 225 (2021); K. Borusyak, X. Jaravel & J. Spiess, REStud (2024).
    • J. Roth, AER: Insights 4 (2022); A. Rambachan & J. Roth, REStud 90 (2023).
  • Synthetic control.
    • A. Abadie & J. Gardeazabal, AER 93 (2003); A. Abadie, A. Diamond & J. Hainmueller, JASA 105 (2010).
    • D. Arkhangelsky, S. Athey, D. Hirshberg, G. Imbens & S. Wager, AER 111 (2021).
  • Panels.
    • Y. Mundlak, Econometrica 46 (1978); S. Nickell, Econometrica 49 (1981).
    • T. Anderson & C. Hsiao, JASA 76 (1981); M. Arellano & S. Bond, REStud 58 (1991); D. Roodman, Oxford Bull. Econ. Stat. 71 (2009).
  • Bounds. C. Manski, AER P&P 80 (1990), Partial Identification of Probability Distributions (2003); D. Lee, REStud 76 (2009).
  • Data. Prop 99 via R's tidysynth (E. Dunford, MIT licence).
About this partfrom its README

Part 37 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), and the seventeenth part of Stage III, Master's. Part 36 adjusted for measured confounders and asked how wrong an unmeasured one could make us. This part looks for pieces of the world that were randomized by accident: instruments, cutoffs, policies that start in some places and not others, and single treated units with many possible controls. When no design identifies the answer, it bounds it.

The part builds statkit.quasi and an instrument, the cutoff lens (CutoffLens): binned means on either side of a cutoff, a triangular-kernel window, local polynomial fits and the jump between them. It adds three World blocks:

  • a schooling survey with quarter of birth as an instrument;
  • a scholarship awarded at an exam score of 60;
  • a staggered rollout of a jobs programme across the 200 towns.

Its real data are:

  • Snow's Table IX, with printed-rate arithmetic disclosed;
  • Card & Krueger's means;
  • the Prop 99 cigarette panel (39 states, 1970–2000), from R's tidysynth package (MIT licence).

It opens with Snow (1855): Southwark & Vauxhall drew water below the sewers, while Lambeth had moved upstream in 1852. Their pipes ran down the same streets. The numbers are 315 vs 37 cholera deaths per 10,000 houses, and 59 in the rest of London as printed. That last rate is an arithmetic error: 1,422/256,423 × 10,000 = 55.46. The table distinguishes printed rates from calculations; the two-company mortality ratio from counts is 8.40 deaths per house, not an individual infection-risk ratio.

From there the part covers:

  • The credibility revolution. Leamer (1983); Angrist & Pischke (2010); four designs and what each identifies; the 2021 Nobel.

  • Instruments. Wright (1928); relevance, independence, exclusion, monotonicity.

    • The World's survey (200,000 adults): Q1 births have 0.146 fewer years of schooling and 0.011 lower log wages.
    • Wald 0.0751 vs truth 0.075; OLS 0.162. 2SLS with three quarters gives 0.072 (0.013), F = 75.
    • The draft lottery (Angrist 1990).
  • Weak instruments.

    • One survey of 5,000: F = 9.0; 2SLS 0.098 (90% CI −0.001 to 0.196); AR set −0.052 to 0.192.
    • Across 1,000 surveys: median F 5.6, and 78% below 10.
    • The size of the 5% t-test: up to 16% at μ² = 1 with ρ = 0.9.
    • Staiger–Stock; Stock–Yogo; tF (in the just-identified Gaussian approximation, F must exceed 104.7 for the usual 1.96 cutoff; 3.43 at F = 10).
    • AR sets: an interval 76%, two rays 13%, the whole line 11%.
  • Many instruments. Quarter × region gives 30 instruments.

    • 2SLS median 0.147 (OLS 0.162); LIML 0.091.
    • Bound–Jaeger–Baker fake quarters: 2SLS 0.180 (SE 0.033), F = 0.87.
    • Mendelian randomization with 40 variants, 10 pleiotropic: IVW 0.339, MR-Egger 0.267 (0.047) with intercept 0.0045, truth 0.30.
  • Regression discontinuity. Thistlethwaite & Campbell (1960). The World's scholarship (40,000 school-leavers):

    • scholars vs the rest +46.5 thousand;
    • at the IK-inspired teaching plug-in bandwidth (h = 33.4), local linear 3.59 (0.12) vs truth 3.0, and local quadratic 2.99 (0.16);
    • a bandwidth sensitivity plot; this plug-in is not independently certified as the exact IK reference implementation or finite-sample optimum;
    • robust bias correction (Calonico, Cattaneo & Titiunik 2014);
    • one study of 2,000: conventional 2.29–4.00, robust 1.27–3.58.
  • RD validity.

    • Teachers re-mark 35% of the scripts at 56–59.9. McCrary's θ is 1.08 (z = 32) against −0.05 when marking is honest.
    • The aptitude jump is only −0.035 (z = −1.7), while the RD estimate collapses to 0.53.
    • Fuzzy RD: a take-up jump of 0.75; 2.25/0.75 = 2.99 (0.21); takers vs non-takers +37.4.
    • Lee's close elections; Caughey & Sekhon; Eggers et al.; a checklist.
  • Difference-in-differences.

    • Card & Krueger: Pennsylvania 23.33 → 21.17, New Jersey 20.44 → 21.03, DiD +2.76 (1.36).
    • The rollout's 2009 cohort vs the never-treated: 0.66 vs truth 0.90; an event study.
  • DiD inference.

    • Town shocks correlate 0.67 from year to year.
    • 1,000 placebo laws: OLS SEs reject 41%, town-clustered 5.5% (Bertrand, Duflo & Mullainathan found 45%).
  • Staggered adoption.

    • 76/56/48 towns adopt in 2004/2009/2014 and 20 never; effects grow 0.7/0.3/0.05 a year; the true ATT is 3.96.
    • TWFE gives −0.49 (0.21).
    • Goodman-Bacon weights: vs never 0.25 (+2.84), early vs later 0.30 (+2.32), later vs already treated 0.45 (−4.14).
    • Callaway–Sant'Anna 3.83 (3.53–4.13); imputation 3.94.
    • Event studies: TWFE vs CS.
  • Honest parallel trends (Rambachan & Roth 2023), on a seeded panel with a 0.2 a year pre-trend and a true effect of 1.0:

    • naive 1.17 (1.07–1.27);
    • linear extrapolation 0.97 (0.86–1.08), including the full covariance of pre- and post-period estimates;
    • breakdown at M = 0.87 under this specified linear-extrapolation departure bound;
    • relative magnitudes with simultaneous pre-jump uncertainty (Bonferroni), rather than treating the estimated pre-trend bound as known. These are explicit one-period teaching restrictions, not a full implementation of Rambachan–Roth Delta-SD inference.
  • Synthetic control (Abadie, Diamond & Hainmueller 2010).

    • Weights: Utah 0.39, Montana 0.23, Nevada 0.20, Connecticut 0.11, New Hampshire 0.05; pre-RMSPE 1.66.
    • The gap is −26.6 packs in 2000, and −19.5 on average over 1989–2000.
    • Placebo ratios rank California 3rd of 39 (p = 0.077), and 3rd among the 29 states with pre-RMSPE at most twice California's (descriptive rank fraction 3/29 = 0.103).
  • Synthetic DiD (Arkhangelsky et al. 2021). Placebo SEs:

    Estimator Estimate SE
    DiD −27.3 17.5
    SC −19.5 10.9
    SDID −15.6 9.5

    Point estimates approximately reproduce the paper's Table 1; these placebo SEs differ from its reported SEs. Inference needs comparability/model assumptions across states. The time weights fall on 1986–88. A range of point estimates such as 15–25 packs is not a confidence interval or an assumption-free causal conclusion.

  • Panel data.

    • Pooled 1.93 against FE = LSDV = Mundlak 0.985 (truth 1).
    • Nickell: FE 0.170 vs the formula's 0.169 (ρ = 0.5, T = 5); Anderson–Hsiao 0.499; Arellano–Bond.
  • Bounds.

    • Manski's worst-case bounds with 19% and 30% non-response: [−0.15, 0.34] (finite-population causal effect 0.123).
    • Lee's plug-in trimming bounds for wages, with 14.7% of observed treated workers estimated as marginal: [−0.99, 1.40] (truth 1.0, naive 0.22).
    • The law of decreasing credibility.

Data:

  • Snow, Card–Krueger and Prop 99 are the Museum's;
  • the schooling survey, the scholarship and the rollout are the World's;
  • the Mendelian randomization, honest-trends, panel and bounds examples are seeded simulations.

Built in this part:

  • statkit.quasi (explainer/stats/kit/quasi.py), checked in tests/test_stats_kit_quasi.py:
    • Instruments: OLS with HC1 and cluster-robust SEs; 2SLS with first-stage F; Anderson–Rubin tests and exact homoskedastic Gaussian linear-IV confidence sets; LIML; IVW and MR-Egger.
    • Regression discontinuity: one-sided local polynomials with triangular weights; sharp and fuzzy RD; conventional and robust bias-corrected intervals; an IK-inspired teaching bandwidth; McCrary's density test.
    • Difference-in-differences: TWFE with clustered SEs; event studies; the Goodman-Bacon decomposition; Callaway–Sant'Anna with influence-function SEs; the imputation estimator; simplified sensitivity illustrations (linear-trend departure and relative magnitudes). The chapter uses local helpers retaining joint event-time covariance and uncertainty in the estimated pre-jump bound.
    • Synthetic control and panels: simplex least squares; synthetic control with placebo ratios; synthetic DiD; the within estimator; Nickell's bias; Anderson–Hsiao.
    • Bounds: Manski; Lee.
  • The World gains schooling, scholarship and rollout (with rollout_panel for fresh draws).
  • The Museum gains SNOW, CARD_KRUEGER and prop99().
  • The cutoff lens (CutoffLens in explainer/stats/viz.py).

The Coverage Board gains eight rows (90% intervals; the last two are 5% tests):

Method Setting Achieved Verdict
2SLS, 30 weak instruments World survey, n = 5,000 17.6% broken
Anderson–Rubin set same 89.4% kept
local linear RD, conventional CI World scholarship, n = 2,000 66.3% broken
robust bias-corrected RD same 90.8% kept
TWFE, clustered CI (for the ATT) World rollout, 200 towns 0.0% broken
Callaway–Sant'Anna same 88.8% kept
DiD test, OLS SEs (size) placebo laws on the World's towns 41.1% broken
DiD test, town-clustered SEs (size) same 5.5% kept
Chapter notes
# Chapter Numbers
0 Snow's Grand Experiment 315 vs 37 per 10,000 houses
1 The credibility revolution four designs
2 Instrumental variables Wald 0.0751 vs OLS 0.162
3 Weak instruments median F 5.6; tF 104.7
4 Many instruments; Mendelian randomization 2SLS 0.147, LIML 0.091; Egger 0.267
5 Regression discontinuity 3.59 vs 2.99 (truth 3.0)
6 RD validity McCrary z = 32; fuzzy 2.99
7 Difference-in-differences Card–Krueger +2.76
8 DiD inference placebo laws: 41% vs 5.5%
9 Staggered adoption TWFE −0.49 vs truth 3.96
10 Honest parallel trends 1.17 → 0.97; breakdown 0.87 under the teaching bound
11 Synthetic control −26.6 packs in 2000
12 Synthetic DiD −15.6 / −19.5 / −27.3
13 Panel data Nickell: 0.170 for 0.5
14 Bounds Manski [−0.15, 0.34]; Lee [−0.99, 1.40]
15 Outro —

Companion material in this repository

The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook: Snow (1855), Table IX. 315 vs 37 deaths per 10,000 houses.
  2. The credibility revolution. Leamer (1983); Angrist & Pischke (2010); the 2021 Nobel.
  3. IV. Wright (1928); 2SLS as two projections; the draft lottery; quarter of birth.
  4. Weak instruments. Staiger–Stock; Stock–Yogo; tF; Anderson–Rubin (Board).
  5. Many instruments; Mendelian randomization.
  6. RD (Thistlethwaite & Campbell 1960). Local linear at the cutoff; robust bias-corrected CIs (Board); Built: the World's scholarship.
  7. RD validity. Manipulation tests; fuzzy RD; close elections.
  8. DiD. The 2×2; Card & Krueger (1994); event studies.
  9. DiD inference. Placebo laws (Bertrand, Duflo & Mullainathan 2004).
  10. Staggered adoption. TWFE's negative weights (Goodman-Bacon 2021); TWFE gets the sign wrong on the World; Callaway–Sant'Anna, Sun–Abraham, Borusyak–Jaravel–Spiess (Board).
  11. Honest parallel trends (Rambachan & Roth 2023).
  12. Synthetic control. Prop 99 (Abadie, Diamond & Hainmueller 2010); placebo inference.
  13. SDID (Arkhangelsky et al. 2021).
  14. Panel data. Fixed effects as FWL; Nickell bias.
  15. Bounds (Manski 1990; Lee 2009).
  16. Outro.

Built: statkit.quasi. Data: Snow; Card–Krueger means; Prop 99 (license checked).

Build the film

python -m videos.stats.stats37.compute        # the part's numbers, into .cache/stats37
python tools/build.py stats37                  # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats37 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/stats/stats37. Setup: see the course page. Source of these notes: the README and the scenes' narration.

Build it
OMP_NUM_THREADS=1 python -m videos.stats.stats37.compute   # once (about two minutes)
python tools/build.py stats37 -q l                         # fast 480p preview
python tools/build.py stats37                              # 1080p30 -> renders/stats37.mp4
python tools/qa_scene.py stats37 Staggered
python tools/lecture_length.py stats37 --floor 50