Stage 3 for agents: maintained rewrite
Source of truth: stages/03_rewrite.md. Rules: erratum.md. Style: the repository’s STYLE.md.
Goal
New code, on current packages, that reproduces every table, figure, and number in the paper from the deposited data.
Do
- Write one script per table or figure, named for what it produces, with cleaning separate from analysis and shared functions in one helpers file. Follow
STYLE.md. - Write everything to
maintained/output/. Beside every figure, write a CSV of every quantity it plots. Beside every formatted table, write its values unrounded. - Keep the paper’s estimator, specification, sample, standard errors, and seed.
- Correct unambiguous coding errors (a wrong variable, index, or column; a covariate the paper’s description says should or should not be there; a rank-deficient model that silently dropped a column). Record each correction for the ground truth and the errata.
- Use the current random-number generator. Where it moves a published number, the ground truth records
environment. - Compare every rendered figure with the published one by eye, in addition to its numbers.
- Blank the timestamps in PDF output.
- Run
run_all.Rtwice from fresh sessions, check both exit statuses, and confirm the second run leavesmaintained/output/byte-identical.
Do not
- Use any published number as an input. If a script seems to need one, the computation upstream is missing.
- Write a script that returns early because its output already exists.
- Accept a comment saying a number “can’t be computed” from the deposit without trying.
- Change an analysis choice because
STYLE.mdor current practice prefers another. - Carry a deposited bug into the rewrite because the archive has it.
Done when
run_all.R runs from a clean session, every table and figure has a script that produces it, no published value is an input, and two runs in a row leave maintained/output/ unchanged.