# Data dictionary - Difference-in-Differences for Regional Data

Companion data for a hands-on R tutorial that asks whether the Affordable Care Act's staggered Medicaid expansion reduced adult mortality, and uses the question to show how <strong>population weighting changes the target parameter</strong> when the units (U.S. counties) differ in size by orders of magnitude. Following Baker, Callaway, Cunningham, Goodman-Bacon and Sant'Anna's (2025) <em>Practitioner's Guide</em>, the post runs an eight-stage DiD pipeline &mdash; 2&times;2 cell means, three equivalent TWFE specifications, covariate-adjusted OR/IPW/DRDID, a 2&times;T event study, the Callaway&ndash;Sant'Anna staggered ATT(g,t) design, and a Rambachan&ndash;Roth HonestDiD sensitivity analysis &mdash; computing every estimate both unweighted and weighted by 2013 adult population. The headline 2&times;2 ATT(2014) flips sign with weighting, from +0.122 deaths per 100,000 unweighted to &minus;2.563 weighted, while no 95% confidence interval at any stage comfortably excludes zero. The two estimands answer different questions &mdash; the typical treated <em>county</em> versus the typical treated <em>adult</em>.


Companion data for the post <https://carlos-mendez.org/post/r_did2/>. Each dataset ships as a labeled Stata `.dta` (v118) plus its source file. Generated by `build_data_dictionary.py`.

## Data sources

| Source | Provides | Reference / URL |
|---|---|---|
| CDC WONDER (mortality) | County-level death counts and crude mortality rates for adults aged 20-64, plus population denominators | U.S. Centers for Disease Control and Prevention, CDC WONDER. <a href="https://wonder.cdc.gov/" target="_blank" rel="noopener">https://wonder.cdc.gov/</a> |
| ACA Medicaid expansion timing | State Medicaid-expansion adoption status, year, and month (the staggered treatment timing) | KFF, Status of State Medicaid Expansion Decisions. <a href="https://www.kff.org/medicaid/issue-brief/status-of-state-medicaid-expansion-decisions-interactive-map/" target="_blank" rel="noopener">https://www.kff.org/medicaid/issue-brief/status-of-state-medicaid-expansion-decisions-interactive-map/</a> |
| County socioeconomic covariates | Unemployment, poverty, and median household income by county-year (baseline covariates) | U.S. Census Bureau / Bureau of Labor Statistics county-level series (as merged in the source file). |
| Replicated study &amp; method references | Empirical example, estimators, and concepts | Baker et al. (2025, arXiv:2503.13323); Callaway &amp; Sant&#x27;Anna (2021); Sant&#x27;Anna &amp; Zhao (2020); Rambachan &amp; Roth (2023); Imbens &amp; Rubin (2015). |

## Dataset links (GitHub)

| File | View on GitHub | Raw (load / download) |
|---|---|---|
| `raw_data.dta` | [view](https://github.com/cmg777/starter-academic-v501/blob/master/content/post/r_did2/data/raw_data.dta) | [raw](https://raw.githubusercontent.com/cmg777/starter-academic-v501/master/content/post/r_did2/data/raw_data.dta) |
| `data_prepared.dta` | [view](https://github.com/cmg777/starter-academic-v501/blob/master/content/post/r_did2/data/data_prepared.dta) | [raw](https://raw.githubusercontent.com/cmg777/starter-academic-v501/master/content/post/r_did2/data/data_prepared.dta) |

## Load in code

```python
import pandas as pd
BASE = "https://raw.githubusercontent.com/cmg777/starter-academic-v501/master/content/post/r_did2/data/"
df = pd.read_stata(BASE + "raw_data.dta")
```

## Datasets

| File | Grain | Rows x Cols | Purpose |
|---|---|---|---|
| `raw_data` | county-year | 31,843 x 22 | Source file as downloaded — merged CDC mortality, population, covariates, and state Medicaid-expansion status before any inclusion filtering. |
| `data_prepared` | county-year | 28,644 x 17 | Cleaned, balanced panel that feeds every DiD stage (2x2, TWFE, OR/IPW/DRDID, 2xT, GxT, HonestDiD), with covariate shares and the 2013 population weight. |

## Cross-file variable index

| Variable | raw_data | data_prepared |
|---|---|---|
| `Description` | ● |  |
| `Post` |  | ● |
| `Treat_2014` |  | ● |
| `county` | ● | ● |
| `county_code` | ● | ● |
| `crude_rate_20_64` | ● | ● |
| `deaths` | ● |  |
| `expansion_status` | ● |  |
| `labor_force` | ● |  |
| `maca` | ● |  |
| `median_income` | ● | ● |
| `perc_female` |  | ● |
| `perc_hispanic` |  | ● |
| `perc_white` |  | ● |
| `population_20_64` | ● | ● |
| `population_20_64_female` | ● |  |
| `population_20_64_hispanic` | ● |  |
| `population_20_64_white` | ● |  |
| `population_total` | ● |  |
| `poverty_rate` | ● | ● |
| `set_wt` |  | ● |
| `state` | ● |  |
| `state_abb` |  | ● |
| `stfips` | ● |  |
| `treat_year` |  | ● |
| `unemp_rate` | ● | ● |
| `unemployed` | ● |  |
| `yaca` | ● | ● |
| `year` | ● | ● |
| `year_code` | ● |  |

### `raw_data`

| Variable | Label | Definition | Construction | Units | Source | Coverage |
|---|---|---|---|---|---|---|
| `state` | State name | Full name of the U.S. state the county belongs to. | From the CDC mortality file. | string | CDC WONDER | raw file |
| `stfips` | State FIPS code | Numeric federal (FIPS) identifier for the state (1-56). | From the CDC mortality file. | FIPS | CDC WONDER | raw file |
| `county` | County name (with state abbrev.) | County name followed by its two-letter state abbreviation, e.g. "Autauga County, AL". | From the CDC mortality file; the trailing two characters give state_abb in the prepared data. | string | CDC WONDER | both files |
| `county_code` | County FIPS code | Five-digit federal (FIPS) county identifier; the unit id for the panel. | From the CDC mortality file. | FIPS | CDC WONDER | both files |
| `year` | Calendar year | Annual time index of the observation. | From the CDC mortality file (2009-2019). | year | CDC WONDER | both files |
| `year_code` | Year code (CDC) | CDC WONDER's year code; numerically equal to the calendar year here. | From the CDC mortality file. | year | CDC WONDER | raw file |
| `deaths` | Deaths, adults 20-64 | Count of deaths among adults aged 20-64 in the county-year. | From the CDC mortality file (numerator of the crude rate). | count | CDC WONDER | raw file |
| `population_20_64` | Population aged 20-64 | County adult population aged 20-64 (denominator of the crude mortality rate). | From the CDC mortality file. | persons | CDC WONDER | both files |
| `crude_rate_20_64` | Crude mortality rate, adults 20-64 | Deaths per 100,000 adults aged 20-64 — the DiD outcome variable. | 100,000 x deaths / population_20_64 (as supplied by CDC WONDER). | per 100,000 | CDC WONDER | both files |
| `population_total` | Total county population | Total resident population of the county-year (all ages). | From the CDC mortality file. | persons | CDC WONDER | raw file |
| `population_20_64_hispanic` | Population 20-64, Hispanic | Adults aged 20-64 identifying as Hispanic (numerator for perc_hispanic). | From the CDC mortality file. | persons | CDC WONDER | raw file |
| `population_20_64_female` | Population 20-64, female | Female adults aged 20-64 (numerator for perc_female). | From the CDC mortality file. | persons | CDC WONDER | raw file |
| `population_20_64_white` | Population 20-64, white | White adults aged 20-64 (numerator for perc_white). | From the CDC mortality file. | persons | CDC WONDER | raw file |
| `unemployed` | Number unemployed | County count of unemployed persons in the labor force. | From the county labor-market series in the merged file. | persons | BLS (merged) | raw file |
| `labor_force` | Civilian labor force | County civilian labor force count (denominator of the raw unemployment rate). | From the county labor-market series in the merged file. | persons | BLS (merged) | raw file |
| `unemp_rate` | Unemployment rate (%) | County unemployment rate (baseline covariate). | Raw fractional rate rescaled to percent (x100) in the prepared data. | % | Derived (BLS) | prepared file |
| `poverty_rate` | Poverty rate (%) | Share of the county population below the federal poverty line. | From the county socioeconomic series in the merged file (already in percent). | % | Census (merged) | both files |
| `median_income` | Median household income | County median household income; in the raw file expressed in US$, rescaled to thousands of US$ in the prepared data. | From the county socioeconomic series; the prepared data divides by 1,000. | US$ (raw) / US$ 000s (prepared) | Census (merged) | both files |
| `expansion_status` | ACA Medicaid expansion status (text) | Whether the state had adopted and implemented Medicaid expansion. | From the state ACA-expansion timing source. | category | KFF / ACA timing | raw file |
| `Description` | Expansion description (free text) | Free-text note on the state's expansion implementation (date, retroactivity, etc.). | From the state ACA-expansion timing source. | string | KFF / ACA timing | raw file |
| `yaca` | Year of ACA Medicaid expansion | Calendar year the state implemented Medicaid expansion; missing (NA) for never-expanders. | Parsed from the state ACA-expansion timing source; arrives as a string with "NA" sentinels and is coerced to numeric. | year | KFF / ACA timing | both files |
| `maca` | Month of ACA Medicaid expansion | Calendar month (1-12) in which the state implemented expansion; missing for never-expanders. | Parsed from the state ACA-expansion timing source. | month (1-12) | KFF / ACA timing | raw file |

| Variable | N | Miss% | Distinct | Min | Mean | Median | Max | SD |
|---|---|---|---|---|---|---|---|---|
| `state` | 31,843 | 0.0 | 51 | — | — | — | — | — |
| `stfips` | 31,843 | 0.0 | 51 | — | — | — | — | — |
| `county` | 31,843 | 0.0 | 3,064 | — | — | — | — | — |
| `county_code` | 31,843 | 0.0 | 3,064 | — | — | — | — | — |
| `year` | 31,843 | 0.0 | 11 | 2009 | 2014.0 | 2014 | 2019 | 3.16 |
| `year_code` | 31,843 | 0.0 | 11 | 2009 | 2014.0 | 2014 | 2019 | 3.16 |
| `deaths` | 31,783 | 0.2 | 1,985 | 0 | 229.8 | 79.00 | 16,188 | 603.6 |
| `population_20_64` | 31,783 | 0.2 | 24,240 | 47.00 | 65,477 | 16,906 | 6,338,759 | 206,172 |
| `crude_rate_20_64` | 31,783 | 0.2 | 30,001 | 0 | 454.1 | 435.9 | 1,883.8 | 158.7 |
| `population_total` | 31,783 | 0.2 | 26,782 | 71.00 | 109,908 | 29,358 | 10,170,292 | 336,957 |
| `population_20_64_hispanic` | 31,783 | 0.2 | 9,396 | 0 | 11,009 | 671.0 | 3,016,128 | 75,656 |
| `population_20_64_female` | 31,783 | 0.2 | 19,955 | 20.00 | 32,949 | 8,370.0 | 3,183,635 | 104,084 |
| `population_20_64_white` | 31,783 | 0.2 | 23,587 | 17.00 | 51,224 | 14,695 | 4,558,532 | 149,425 |
| `unemployed` | 31,758 | 0.3 | 7,939 | 4.00 | 3,515.2 | 873.0 | 621,950 | 12,818 |
| `labor_force` | 31,758 | 0.3 | 23,031 | 43.00 | 54,367 | 13,724 | 5,148,584 | 169,077 |
| `unemp_rate` | 31,758 | 0.3 | 31,497 | 0.011 | 0.067 | 0.061 | 0.294 | 0.031 |
| `poverty_rate` | 31,777 | 0.2 | 448 | 2.60 | 16.44 | 15.50 | 56.70 | 6.43 |
| `median_income` | 31,777 | 0.2 | 22,080 | 18,860 | 47,863 | 45,641 | 151,806 | 13,223 |
| `expansion_status` | 31,843 | 0.0 | 2 | — | — | — | — | — |
| `Description` | 22,054 | 30.7 | 18 | — | — | — | — | — |
| `yaca` | 22,054 | 30.7 | 7 | 2014 | 2016.2 | 2014 | 2023 | 3.10 |
| `maca` | 22,054 | 30.7 | 8 | — | — | — | — | — |

### `data_prepared`

| Variable | Label | Definition | Construction | Units | Source | Coverage |
|---|---|---|---|---|---|---|
| `state_abb` | State abbreviation | Two-letter U.S. state postal abbreviation. | Last two characters of the county string (str_sub). | code | Derived | prepared file |
| `county` | County name (with state abbrev.) | County name followed by its two-letter state abbreviation, e.g. "Autauga County, AL". | From the CDC mortality file; the trailing two characters give state_abb in the prepared data. | string | CDC WONDER | both files |
| `county_code` | County FIPS code | Five-digit federal (FIPS) county identifier; the unit id for the panel. | From the CDC mortality file. | FIPS | CDC WONDER | both files |
| `year` | Calendar year | Annual time index of the observation. | From the CDC mortality file (2009-2019). | year | CDC WONDER | both files |
| `population_20_64` | Population aged 20-64 | County adult population aged 20-64 (denominator of the crude mortality rate). | From the CDC mortality file. | persons | CDC WONDER | both files |
| `yaca` | Year of ACA Medicaid expansion | Calendar year the state implemented Medicaid expansion; missing (NA) for never-expanders. | Parsed from the state ACA-expansion timing source; arrives as a string with "NA" sentinels and is coerced to numeric. | year | KFF / ACA timing | both files |
| `crude_rate_20_64` | Crude mortality rate, adults 20-64 | Deaths per 100,000 adults aged 20-64 — the DiD outcome variable. | 100,000 x deaths / population_20_64 (as supplied by CDC WONDER). | per 100,000 | CDC WONDER | both files |
| `perc_female` | Female share, adults 20-64 (%) | Percent of the county's 20-64 population that is female (baseline covariate). | 100 x population_20_64_female / population_20_64. | % | Derived (CDC) | prepared file |
| `perc_white` | White share, adults 20-64 (%) | Percent of the county's 20-64 population that is white (baseline covariate). | 100 x population_20_64_white / population_20_64. | % | Derived (CDC) | prepared file |
| `perc_hispanic` | Hispanic share, adults 20-64 (%) | Percent of the county's 20-64 population that is Hispanic (baseline covariate). | 100 x population_20_64_hispanic / population_20_64. | % | Derived (CDC) | prepared file |
| `unemp_rate` | Unemployment rate (%) | County unemployment rate (baseline covariate). | Raw fractional rate rescaled to percent (x100) in the prepared data. | % | Derived (BLS) | prepared file |
| `poverty_rate` | Poverty rate (%) | Share of the county population below the federal poverty line. | From the county socioeconomic series in the merged file (already in percent). | % | Census (merged) | both files |
| `median_income` | Median household income | County median household income; in the raw file expressed in US$, rescaled to thousands of US$ in the prepared data. | From the county socioeconomic series; the prepared data divides by 1,000. | US$ (raw) / US$ 000s (prepared) | Census (merged) | both files |
| `set_wt` | Fixed 2013 adult population weight | Each county's 2013 population aged 20-64, held constant across all 11 years (the population weight). | population_20_64 in 2013, broadcast to every year of the county so weighting does not conflate population growth with mortality change. | persons | Derived (CDC) | prepared file |
| `treat_year` | Treatment year (did convention) | Year the county's state expanded Medicaid (2014/2015/2016/2019), or 0 for never-treated counties. | yaca if 2014 <= yaca <= 2019, else 0 — the did package's never-treated coding. | year / 0 | Derived | prepared file |
| `Treat_2014` | 2014-cohort treatment dummy | 1 if the county's state expanded Medicaid in 2014, else 0. | 1 if yaca == 2014, else 0. | 0/1 | Derived | prepared file |
| `Post` | Post-2014 period dummy | 1 for years 2014 and later, else 0 (the post period in the 2x2 design). | 1 if year >= 2014, else 0. | 0/1 | Derived | prepared file |

| Variable | N | Miss% | Distinct | Min | Mean | Median | Max | SD |
|---|---|---|---|---|---|---|---|---|
| `state_abb` | 28,644 | 0.0 | 46 | — | — | — | — | — |
| `county` | 28,644 | 0.0 | 2,604 | — | — | — | — | — |
| `county_code` | 28,644 | 0.0 | 2,604 | — | — | — | — | — |
| `year` | 28,644 | 0.0 | 11 | 2009 | 2014.0 | 2014 | 2019 | 3.16 |
| `population_20_64` | 28,644 | 0.0 | 22,256 | 1,793.0 | 65,737 | 18,232 | 6,338,759 | 207,493 |
| `yaca` | 19,459 | 32.1 | 7 | 2014 | 2016.2 | 2014 | 2023 | 3.10 |
| `crude_rate_20_64` | 28,644 | 0.0 | 27,553 | 72.33 | 458.3 | 441.6 | 1,560.7 | 153.7 |
| `perc_female` | 28,644 | 0.0 | 28,483 | 24.15 | 49.37 | 50.02 | 60.28 | 3.05 |
| `perc_white` | 28,644 | 0.0 | 28,599 | 10.10 | 84.95 | 91.72 | 99.70 | 16.49 |
| `perc_hispanic` | 28,644 | 0.0 | 28,532 | 0.150 | 8.39 | 3.65 | 96.43 | 12.86 |
| `unemp_rate` | 28,644 | 0.0 | 28,484 | 1.07 | 6.83 | 6.23 | 29.41 | 3.08 |
| `poverty_rate` | 28,644 | 0.0 | 438 | 2.60 | 16.66 | 15.90 | 50.40 | 6.45 |
| `median_income` | 28,644 | 0.0 | 20,550 | 20.99 | 47.62 | 45.24 | 151.8 | 13.23 |
| `set_wt` | 28,644 | 0.0 | 2,534 | 1,891.0 | 65,530 | 18,408 | 6,221,536 | 206,632 |
| `treat_year` | 28,644 | 0.0 | 5 | — | — | — | — | — |
| `Treat_2014` | 28,644 | 0.0 | 2 | 0 | 0.376 | 0 | 1.00 | 0.484 |
| `Post` | 28,644 | 0.0 | 2 | 0 | 0.545 | 1.00 | 1.00 | 0.498 |

## Known limitations & caveats

- <strong>Pedagogical, not definitive.</strong> The authors of the replicated guide flag this case as illustrative: "The results are pedagogical in spirit and do not represent the best possible estimates of Medicaid's effect on adult mortality."
- <strong>Underpowered.</strong> None of the six 2x2 covariate-adjusted 95% confidence intervals excludes zero; the data cannot settle the policy question.
- <strong>Weighting changes the estimand.</strong> Unweighted (ATT for the typical treated county) and population-weighted (ATT for the typical treated adult) answer different causal questions; the 2x2 ATT(2014) flips sign between them (+0.122 vs -2.563).
- <strong>Crude, not age-adjusted.</strong> The outcome is the CDC crude death rate for ages 20-64, not an age-adjusted rate, so compositional differences across cohorts are not removed.
- <strong>Small cohorts are noisy.</strong> The 2015, 2016, and 2019 expansion cohorts are small (171 / 93 / 140 counties); cohort-specific estimates carry wide confidence intervals.
- <strong>Tutorial bootstrap.</strong> The Callaway-Sant'Anna bootstrap uses 2,000 iterations for speed (the reference scripts use 25,000), affecting the third significant figure of each CI.

---

*Generated by `build_data_dictionary.py`. Stata format: .dta v118.*
