Python

Introduction to the Synthetic Control Method in Python with mlsynth

How much did Proposition 99, the 1989 California tobacco program, reduce cigarette sales? This beginner Python tutorial teaches the synthetic control method, which builds a look-alike California from other states, finds about 19 fewer packs sold per person each year, and then tries hard to break that result. It comes with an interactive app that runs in your web browser.

Introduction to Panel Data Methods in Python

Does joining a union raise wages? Following the same workers over two years in Python, we compare seven ways to analyze repeated data and see that the estimated wage gain nearly triples once each worker is compared with the same worker at another time. It comes with an interactive app that runs in your web browser.

The FWL Theorem: Making Multivariate Regressions Intuitive

What does it really mean to control for another factor in a regression? This Python tutorial uses a simulated fast food coupon campaign to show that any such result can be rebuilt by first removing what the other factors explain and then plotting what is left in a simple two-variable chart. It comes with an interactive app that runs in your web browser.

Evaluating the Impact of Infrastructure: A Beginner's Guide to Difference-in-Differences with the Jamuna Bridge

When a major bridge connected millions of people in northwest Bangladesh to the capital in 1998, did the region's economy take off? This beginner-friendly Python tutorial uses satellite images of nighttime lights to compare the connected region with a similar one that stayed isolated, before and after the bridge opened.

Bayesian Spatial Synthetic Control in Python: California's Proposition 99 with scspill and mlsynth

Did the 1988 California tobacco law cut cigarette sales, and did it also affect neighboring states such as Nevada? This Python tutorial builds a look-alike California from other states in three steps, the last one letting nearby states be affected too, and finds that the drop in California holds up. It comes with an interactive app that runs in your web browser.

The Synthetic Control Ladder in Python: A Guided Tour of mlsynth on the Brexit Referendum

How much did the 2016 Brexit vote cost the British economy? This Python tutorial builds a look-alike United Kingdom from other wealthy economies with six related methods, finds output about 3 percent lower by the end of 2018, and shows how default settings can quietly change the answer. It comes with an interactive app that runs in your web browser.

From DiD to SDID: A Ladder of Synthetic Control Estimators, and What Brexit Cost the UK

How much did the 2016 Brexit vote cost the economy of the United Kingdom? We build a look-alike United Kingdom from other rich countries, step by step through a ladder of increasingly flexible methods, and compare what each step says. This R tutorial includes cheat sheets for Stata and Python and an interactive app that runs in your web browser.

Covariates in Difference-in-Differences: The LaLonde Test in Python

Can we still find the true effect of a job training program on earnings if we compare trainees with ordinary survey respondents instead of a randomized control group? This Python tutorial shows that adding background characteristics fixes the estimate only when they adjust the expected earnings trend of the comparison group. It comes with an interactive app that runs in your web browser.

Regional Inequality from Outer Space: Predicting GDP from Nighttime Lights and Building Inequality Indices in Python

Learn how to turn satellite images of nighttime lights into estimates of regional income, then measure how unequal regions are within each country. Step by step in Python, we test whether regional inequality first rises and then falls as countries develop.

Do Industrial Parks Work? Evaluating Place-Based Policy in Ethiopia with Difference-in-Differences

Do industrial parks bring more economic activity to nearby towns, and who benefits? This Python tutorial compares places that got a park with places that did not, before and after it opened, using simulated data modeled on Ethiopia, and also looks at household welfare and outcomes for women. It comes with an interactive app that runs in your web browser.