Data and reproducibility
The teaching sequence follows the ECO603 syllabus. Its technical development adapts Shi Qiu’s Overleaf lectures on regression, inference, asymptotics, specification and data issues, time series, panel methods, instrumental variables and binary response. The causal-graph framework includes law enforcement, control selection, sample selection, dated inputs and pooled housing comparisons. Each topic links that framework to its empirical question. The examples use historical teaching data and actual StataMP runs. Their purpose is to develop empirical reasoning, rather than provide current policy estimates.
For the intervention and potential-outcome framework, see Hernán and Robins, Causal Inference: What If. For graphical path rules, see the DAGitty authors’ d-separation tutorial.
Observed applications
- California schools: 420 districts; test scores, students per teacher, English-learner percentage and district income in thousands of dollars.
- Retail prices: 401 complete positive-price and positive-income records from the earlier course's reduced retail dataset. The file does not establish unique stores or geographic sampling units. Income is in dollars; the rescaled variable is in ten-thousand-dollar units.
- California traffic: 108 monthly observations, January 1981–December 1989; accidents, unemployment, law indicators and calendar controls. Monthly dates and archived indicators are checked before estimation.
- Traffic fatalities: 48 states observed for seven years, 1982–1988. Fatality rate is deaths per 10,000 residents; beer tax is in dollars.
- Cigarette demand: 48 states in 1995. Quantity is packs per capita; price and tax variables use consumer-price-index-adjusted source units. The proposed instrument is the sales-tax component in real cents per pack. State comparisons require the explicit assumptions discussed in Lesson 14.
- Mortgage decisions: 2,380 Boston-area applications in the historical mortgage teaching sample. Denial is coded from the archived decision field; payment-to-income ratio is converted from the source percentage scale to a fraction.
Stock–Watson teaching resources · Stata regression reference · Stata Newey–West reference
Further applied examples
The variance example uses actual district scores, staffing, language share and enrolment. Enrolment weighting is an explicit candidate variance model, not an established fact. The prediction example reserves 140 of the 420 districts for testing and tunes ridge/lasso only inside its 280-district training sample. See the Stata elastic-net reference and prediction guidance.
The DiD sequence adapts Shi Qiu’s dedicated Overleaf Head Start lesson: Wikle and Wilson (2023) motivate the maternal-employment question. The time-allocation and A/B/C/D diagrams, location comparisons and 300-person experiment are explicitly constructed teaching examples.
The real-data extension follows the same NSW/CPS example used in that lecture. Its selected file retains 16,417 people observed in 1975 and 1978: NSW experimental controls and CPS comparison observations. Actual trainees are excluded. This is a placebo data-source comparison, not a Head Start or training-effect estimate. The selected teaching variables are supplied in nsw_cps.csv. For the estimator, see Sant’Anna and Zhao (2020) and the Stata DRDID documentation.
Constructed examples
The repeated-sample and measurement-error examples, the AR process control, the two-group difference-in-differences diagram and the quarterly shock-response experiment are explicitly constructed. The quarterly process has a known response of 0.8 times 0.6 to the horizon power. Its estimated responses and intervals come from actual Stata regressions on the simulated data. No estimated point is replaced with its theoretical target.
Run the examples
Download the Stata examples and selected variables, extract the archive and set Stata's working directory to that folder. Run the week's do-file or the marked block named in the exercise. Shared lab files retain stable identifiers and can support more than one week. The core examples use built-in Stata commands. The doubly robust DiD extension uses the drdid package; follow its linked author documentation if it is not installed. The scripts create their own result files in that folder. Slide tables omit calendar-indicator rows when they distract from the target comparison. The separate output downloads preserve actual numerical results from the course runs; machine-specific log headers and paths are omitted.
Read the graphics
Observed scatterplots and time paths use the exported data. Coefficient displays use the corresponding estimates. Simulation graphics are labelled. Where an interval is described as approximate, it uses the displayed coefficient plus or minus 1.96 standard errors. Graph controls change the illustrated quantity; they do not silently re-estimate a model. Each plot supplies its units and interpretation alongside the transcript.