Reproducibility Guide (Nature Human Behaviour)
This README maps the paper’s tables and figures to the scripts, data inputs, and output files that reproduce them.
Working directory
Run the analysis scripts from analysis/, not from the repository root. The scripts use relative paths such as ../data/... and ../computed_objects/....
Recommended invocation pattern:
cd analysis
Rscript co_experiment_data.R
Canonical data sources
The analysis uses two canonical raw datasets:
data/complete_data_DS.dta: task-level dataset including treatment, control, and data scientist (DS) arms.data/complete_data_all.dta: full cohort dataset used for sample-flow, completion, timing, learning, and attrition analyses.Derived datasets used across analyses
The repository builds two core derived datasets:
computed_objects/experimental_data.csv: built from data/complete_data_DS.dta by analysis/co_experiment_data.R. This is the main analysis dataset used by most treatment-effect tables and figures.computed_objects/experimental_data_all.csv: built from data/complete_data_all.dta by analysis/co_experiment_data_all.R. This is used for completion, timing, and related analyses.Dependencies
.do files used for Lee bounds and attrition analyses.Required R packages
The analysis scripts import the following R packages:
dplyrtidyrggplot2stargazerhavenlfelmtestsandwichforcatsmagrittrmsmcarbroomreadrlatex2expquantregJJHmiscFor CRAN packages, you can install them with:
install.packages(c(
"dplyr",
"tidyr",
"ggplot2",
"stargazer",
"haven",
"lfe",
"lmtest",
"sandwich",
"forcats",
"magrittr",
"msm",
"car",
"broom",
"readr",
"latex2exp",
"quantreg",
"devtools"
))
Install JJHmisc from GitHub:
# Install devtools if you haven't already
install.packages("devtools")
# Install JJHmisc from GitHub
devtools::install_github("johnjosephhorton/JJHmisc")
Output directories
Generated outputs are written to multiple locations in writeup/, primarily:
writeup/plots/writeup/tables/writeup/stable/writeup/Main text tables and figures
Table 1. Building the experimental sample
writeup/stable/balance_table_small.texanalysis/table_sample.Rdata/complete_data_all.dta, computed_objects/experimental_data.csv, computed_objects/experimental_data_all.csvFigure 1. Effect of AI treatment on workers’ ability to solve data science problems
writeup/plots/grades.pdfanalysis/plot_task_grades.Rcomputed_objects/experimental_data.csvFigure 2. Effect of AI treatment by prior coding experience
writeup/plots/grades_by_code.pdfanalysis/plot_task_grades_het.Rcomputed_objects/experimental_data.csvFigure 3. Post-experiment data science knowledge without GenAI
writeup/plots/learning.pdfanalysis/table_learning.Rdata/complete_data_all.dtaFigure 4. Predictions about ChatGPT capabilities / calibration treatment effects
writeup/plots/callibration_te.pdfanalysis/table_callibration.Rcomputed_objects/experimental_data.csvAppendix tables and figures
Table B9
writeup/performanceDSBaseline.texanalysis/table_benchmark.Rdata/complete_data_DS.dtaTables B10-B13
writeup/task_correct_het1.texwriteup/task_correct_het2.texwriteup/task_correct_het3.texwriteup/task_correct_het4.texanalysis/table_task_grades.Rcomputed_objects/experimental_data.csvTable B14
writeup/tables/learning.texanalysis/table_learning.Rdata/complete_data_all.dtaLearning robustness table
writeup/learning_robustness.texanalysis/table_learning.Rcomputed_objects/experimental_data.csvTable B15 (Lee bounds)
analysis/leebounds.dodata/complete_data_DS.dta, restricted to treatment_arm in {0,1}Tables B16-B18
writeup/tables/robust_coding.texwriteup/tables/robust_stats.texwriteup/tables/robust_ps.texanalysis/table_robust.Rcomputed_objects/experimental_data.csvTables B19-B21
writeup/tables/grades_detail_coding.texwriteup/tables/grades_detail_stats.texwriteup/tables/grades_detail_ps.texanalysis/tab_task_detailed.Rcomputed_objects/experimental_data.csvProfessional identity / belief appendix tables
writeup/tables/professional_identity.texwriteup/tables/belief_chatgpt.texanalysis/table_confidencechange.Ranalysis/table_careerbeliefs.Rdata/complete_data_DS.dtaCompletion and timing appendix tables
writeup/tables/task_finish.texwriteup/tables/task_finish2.texwriteup/time.texanalysis/table_finish.Ranalysis/table_time.Rcomputed_objects/experimental_data_all.csvCalibration regression table
writeup/callibration.texanalysis/table_callibration.Rcomputed_objects/experimental_data.csvFigure B3
writeup/plots/grades_dist.pdfanalysis/plot_task_grades.Rcomputed_objects/experimental_data.csvFigure B4
writeup/plots/grades_by_code_dist.pdfanalysis/plot_task_grades_het.Rcomputed_objects/experimental_data.csvFigure B5
writeup/plots/learning_dist.pdfanalysis/table_learning.Rdata/complete_data_all.dtaRecommended execution order
The sequence below is the recommended order for reproducing the paper-facing outputs.
Step 1: build the main analysis dataset
cd analysis
Rscript co_experiment_data.R
Produces computed_objects/experimental_data.csv.
Step 2: build the full-sample derived dataset
Rscript co_experiment_data_all.R
Produces computed_objects/experimental_data_all.csv.
Step 3: run the paper-facing table and figure scripts
Rscript table_sample.R
Rscript plot_task_grades.R
Rscript plot_task_grades_het.R
Rscript table_learning.R
Rscript table_callibration.R
Rscript table_benchmark.R
Rscript table_task_grades.R
Rscript table_robust.R
Rscript tab_task_detailed.R
Rscript table_finish.R
Rscript table_time.R
Rscript table_confidencechange.R
Rscript table_careerbeliefs.R
Step 4: run the Stata robustness / attrition files if needed
stata -b do leebounds.do
stata -b do attrition.do
These scripts require Stata and are needed for the Lee-bounds / attrition appendix outputs.