Audit all theory restrictions in the paper for data coverage, variable documentation, and summary statistics inclusion. Produces a report with issues and fixes.
Cross-reference every restriction in the paper against (1) data availability, (2) paper documentation, and (3) summary statistics coverage. Produces a structured report and optionally applies fixes.
$ARGUMENTS = report (default): produce the audit report only, do not edit files$ARGUMENTS = fix: produce the report AND apply corrections to paper filesRead all restriction tables from paper/tables_and_figures.tex (Tables 2–9). For each restriction, extract:
Build a complete registry: restriction_number | restriction_name | variables_needed | variable_type
For each variable identified in Phase 1:
code/utils/data_loader.py for _MACRO_COLS and load a sample of data/processed/panel_monthly.parquet column names to verify the variable existsdata/raw/ for source files and code/data_pipeline/build_panel.py for construction logicBidAskSpread for search intensity). Flag these as "proxy" not "exact match"Classify each variable as:
build_panel.pyFor each restriction, verify the paper explains how the data is obtained. Check these files:
paper/sections/estimation.tex or paper/sections/empirical.tex — should have a "Data" subsectionpaper/sections/framework.tex — may document variable constructionpaper/sections/introduction.tex — may reference data sourcesFor each variable, check:
Classify each as:
Read the Table 1 generator (code/tables/summary_stats.py) and the generated paper/tables/table_1.tex. For each variable used in restrictions:
Classify as:
Write the audit report to quality_reports/restriction_audit.md with:
# Restriction Data Audit — [date]
## Summary
- Total restrictions: X
- Variables covered: Y / Z
- Documentation gaps: N
- Summary stats gaps: M
## Restriction-by-Variable Matrix
| # | Restriction | Variable | Data Status | Paper Doc | Summary Stats |
|---|------------|----------|-------------|-----------|---------------|
| 1 | Power utility | cons_growth | AVAILABLE | DOCUMENTED | IN TABLE |
| ... | ... | ... | ... | ... | ... |
## Issues Found
### Data Gaps
[List variables with MISSING or CONSTRUCTIBLE status]
### Documentation Gaps
[List variables with UNDOCUMENTED or PARTIAL status]
### Summary Statistics Gaps
[List variables with SHOULD ADD status]
## Recommended Fixes
[Specific actions: add to summary stats, add documentation paragraph, etc.]
fix)Only if $ARGUMENTS = fix:
code/tables/summary_stats.py to add missing variables to Panel A or Panel Bpaper/sections/estimation.tex to cover undocumented variablespython -m code.generate_tables --table 1latexmk -pdf -cd paper/main.texquality_reports/restriction_audit.md