pipeline
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest +…
County Presidential Returns 2000-2024 (MIT MEDSL). Vote shares, party trends, turnout by county_fips (joins census/education data). Requires HARVARD_DATAVERSE_API_KEY. Critical: mode='TOTAL' drops ~1K counties post-2020 — use 3-pattern reconstruction
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill election-data-source-countypres --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/election-data-source-countypresContext preview
The summary Claude sees to decide when to auto-load this skill.
County Presidential Returns 2000-2024 (MIT MEDSL). Vote shares, party trends, turnout by county_fips (joins census/education data). Requires HARVARD_DATAVERSE_API_KEY. Critical: mode='TOTAL' drops ~1K counties post-2020 — use 3-pattern reconstruction
name: election-data-source-countypres description: >- County Presidential Returns 2000-2024 (MIT MEDSL). Vote shares, party trends, turnout by county_fips (joins census/education data). Requires HARVARD_DATAVERSE_API_KEY. Critical: mode='TOTAL' drops ~1K counties post-2020 — use 3-pattern reconstruction metadata: audience: any-agent domain: data-source skill-authored: "2026-02-23" skill-last-updated: "2026-02-24"
County Presidential Election Returns 2000-2024 from MIT Election Data and Science Lab (MEDSL). Use when analyzing county-level presidential vote shares, party trends, turnout, or geographic voting patterns. Key join column county_fips enables linking to census, education (CCD/SAIPE), and demographic datasets. Requires Harvard Dataverse API key (HARVARD_DATAVERSE_API_KEY env var). Categorical variables use uppercase strings, not Portal integer codes. Critical caveat: naive mode='TOTAL' filtering silently drops ~1,000 counties in 2020+ data — use 3-pattern reconstruction.
The authoritative source for county-level U.S. presidential election returns spanning 2000-2024. Provides candidate-level vote counts across all 50 states and DC, enabling vote share analysis, partisan trend mapping, and cross-domain geographic research via FIPS code joins.
> **CRITICAL: Value Encoding** > > This dataset uses **uppercase string codes** for categorical variables (party, mode, > candidate, state) rather than integer codes. Empty strings (`""`) appear as > undocumented values in `party` (501 rows, 2024) and `mode` (2,795 rows, 2024). > > | Context | party | mode | candidate | > |---------|-------|------|-----------| > | **Standard values** | `DEMOCRAT`, `REPUBLICAN` | `TOTAL` | `BARACK OBAMA` | > | **Aggregate/meta values** | `OTHER`, `""` | `""`, `ELECTION DAY` | `OTHER`, `UNDERVOTES` | > > See `./references/variable-definitions.md` for complete encoding tables.
> **API Key Required:** This data source requires a **Harvard Dataverse API key** to fetch data. > Unlike education data sources (which use the Urban Institute's free, unauthenticated API), > election data is hosted on Harvard Dataverse and requires authentication. > > **Setup instructions:** > 1. Create a free Harvard Dataverse account at https://dataverse.harvard.edu/ > 2. Log in, navigate to your account name (top-right) → API Token > 3. Click "Create Token" and copy it > 4. Set the environment variable **before launching Claude Code**: > ```bash > export HARVARD_DATAVERSE_API_KEY="your_token_here" > ``` > For Docker users: run this inside the container after `docker compose exec daaf-docker bash` > but before `claude`. To make it persistent across sessions, add it to `~/.bashrc`. > > **If the key is missing**, any fetch script will fail with a `KeyError: 'HARVARD_DATAVERSE_API_KEY'`. > The orchestrator should check for this variable's existence before dispatching Stage 5 fetch tasks > that use this data source.
| File | Purpose | When to Read | |------|---------|--------------| | `variable-definitions.md` | Complete column specs, party/mode/candidate value tables | Interpreting specific columns or coded values | | `coded-values.md` | All categorical value mappings with frequencies | Filtering or recoding party, mode, candidate | | `columns.md` | Detailed per-column profiling (types, nulls, ranges) | Understanding column characteristics | | `quality-notes.md` | Known issues, anomalies, duplicates, null patterns | Assessing data reliability | | `mode-reconstruction.md` | 3-pattern TOTAL mode reconstruction for 2020+ data | Cleaning any 2020+ analysis (CRITICAL) | | `interpretations.md` | Preliminary semantic interpretations (flagged for review) | Understanding column meanings |
Analyzing presidential election data? ├─ County-level vote shares → Use 3-pattern mode reconstruction (./references/mode-reconstruction.md) │ └─ Longitudinal (cross-year) → MUST reconstruct TOTAL for 2020+ (naive filter drops ~1,000 counties) │ └─ Single year (pre-2020) → Safe to filter mode='TOTAL' │ └─ Single year (2020/2024) → Reconstruct unless analyzing a known TOTAL-only state ├─ Party trends → Group by year + party, use party column (not candidate name) │ └─ Third parties → See ./references/coded-values.md (GREEN/LIBERTARIAN vary by year) ├─ Turnout analysis → Use totalvotes column (dedup per county-year before summing!) ├─ Joining with other data → Use county_fips as join key (zero-pad to 5 chars first!) │ └─ Census/ACS data → Join on county_fips (standard 5-digit string) │ └─ Education data (CCD/SAIPE) → Join on county_fips │ └─ Null FIPS? → See ./references/quality-notes.md (CT, ME, RI) └─ Voting method analysis → 2020 and 2024 only, see mode breakdown
Unexpected values? ├─ county_fips is null → CT/ME/RI in pre-2020 years (52 rows) ├─ county_fips > 72999 → Kansas City MO (FIPS 2938000, non-standard) ├─ county_fips join failures → Zero-pad to 5 chars! (AR codes = 4 digits as int) ├─ AR FIPS 5135 has two counties → Source data error: St. Francis under Sharp County │ └─ See ./references/quality-notes.md #arkansas-fips-conta
📌 文档结构(2026-07-22 起): 本文件是中文默认入口 —— banner + badges + 信任面 + 9 阶段流水线速览 + 76 行合集总表。 每个合集的完整描述、按用途分组、精确数字、验证方法在 docs/CONTENT_ZH.md(扩展正文,总表行内的 → 直接跳转到对应锚点)。 English version: README-en.md · 中文扩展正文:docs/CONTENT_ZH.md · README-zh-CN.md 已弃用(重定向占位) 🌐 语言: English |
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest +…
Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics paper (AER / QJE / JPE / ReStud /…
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest +…
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation +…
Classical end-to-end empirical analysis workflow in the modern tidyverse + econometrics R ecosystem — dplyr + tidyr + haven + fixest + sandwich + lmtest +…
Systematic writing framework for philosophy and interdisciplinary academic papers from optimized outline to submission-ready manuscript. Use when users want…