########################
OVERVIEW
########################

This file explains how to reproduce all results, figures, and tables in the paper. Figures are made in R and exported 
to LaTeX as tikz drawings in .tex files. These .tex files are imported into the main manuscript. Because the main 
manuscript is not included, the file "create-figures.tex" in the main directory can also be compiled to draw all 
figures.


########################
DATA AVAILABILITY AND PROVENANCE
########################

This paper uses data from Garthwaite, Gross, and Notowidigdo (Quarterly Journal of Economics, 129(2), 2014). The raw
public use data file is available at

	http://www.nber.org/~notom/ggn-replication-kit.zip

The data used here is contained in "ggn.dta". The replication instructions below show how this file is used.


########################
COMPUTATIONAL REQUIREMENTS
########################

The analysis was performed on R 4.3.2 with packages "tikzDevice" (0.12.6) and "haven" (2.5.4). Drawing the figures 
requires the presence  of TeX binaires with pdflatex. The path to pdflatex may need to be adjusted. The included 
figures were compiled in TeX Live 2024.

The analysis for Table 1, Figure 1, and Table 3 was performed on an M1 Mac with 16GB of memory running macOS 14.
Almost no disk space is used. The analysis for Figure 2 and 3, Table 2, and Table 4 was performed on Intel Xeon 
Platinum 8000 series processors with 72GiB of memory running Amazon Linux 2 at up to 3.6 GHz. The analysis was 
performed in parallel with one R instance per virtual CPU. Computing all tables and figures in the paper takes
about 8 hours in total. Almost no disk space is used. 


########################
INSTRUCTIONS FOR DATA PREPARATION AND ANALYSIS
########################


########################
Table_1: Run "Table1.R" to produce "Table1.csv". These are the weights listed in Table 1 in the paper.


########################
Figure_1: Run "fig1.R" to produce "fig1.tex" via the R package "tikzDevice". This generates tikz code for Figure 1. 
For drawing, "fig1.tex" is imported into the main manuscript.


########################
Figures 2 and 3: Run one-by-one or simultaneously in bash or a similar shell (this may take several hours)

	R CMD BATCH --no-save --no-restore '--args 16 5 0 0' ct_comparison-aws.R ct_comparison-aws-16-5-0-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 5 0 0' ct_comparison-aws.R ct_comparison-aws-51-5-0-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 5 0 1' ct_comparison-aws.R ct_comparison-aws-51-5-0-1.out &
	R CMD BATCH --no-save --no-restore '--args 16 5 3 0' ct_comparison-aws.R ct_comparison-aws-16-5-3-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 5 3 0' ct_comparison-aws.R ct_comparison-aws-51-5-3-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 5 3 1' ct_comparison-aws.R ct_comparison-aws-51-5-3-1.out &
	R CMD BATCH --no-save --no-restore '--args 51 1 3 0' ct_comparison-aws.R ct_comparison-aws-51-1-3-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 9 3 0' ct_comparison-aws.R ct_comparison-aws-51-9-3-0.out &
	R CMD BATCH --no-save --no-restore '--args 16 5 2 0' ct_comparison-aws.R ct_comparison-aws-16-5-2-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 5 2 0' ct_comparison-aws.R ct_comparison-aws-51-5-2-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 5 2 1' ct_comparison-aws.R ct_comparison-aws-51-5-2-1.out &
	R CMD BATCH --no-save --no-restore '--args 51 1 2 0' ct_comparison-aws.R ct_comparison-aws-51-1-2-0.out &
	R CMD BATCH --no-save --no-restore '--args 51 9 2 0' ct_comparison-aws.R ct_comparison-aws-51-9-2-0.out &

to produce the following data used for Figures 2 and 3:

	ct_comparison-aws-16-5-0-0.txt
	ct_comparison-aws-51-5-0-0.txt
	ct_comparison-aws-51-5-0-1.txt
	ct_comparison-aws-16-5-3-0.txt
	ct_comparison-aws-51-5-3-0.txt
	ct_comparison-aws-51-5-3-1.txt
	ct_comparison-aws-51-1-3-0.txt
	ct_comparison-aws-51-9-3-0.txt
	ct_comparison-aws-16-5-2-0.txt
	ct_comparison-aws-51-5-2-0.txt
	ct_comparison-aws-51-5-2-1.txt
	ct_comparison-aws-51-1-2-0.txt
	ct_comparison-aws-51-9-2-0.txt

These .txt files are included for convenience. Next, run "ct_comparison-figs.R" to produce "ct_comparison-fig-size.tex" 
and "ct_comparison-fig-pow.tex" via the R package "tikzDevice". This generates tikz code for Figures 2 and 3, 
respectively. For drawing, both .tex files are imported into the main manuscript.


########################
Table 2: Run "ctfp_comparison.R" to produce (this may take several hours)

	ctfp_comparison-1-0-0.txt
	ctfp_comparison-5-0-0.txt
	ctfp_comparison-5-0-1.txt
	ctfp_comparison-5-0-2.txt
	ctfp_comparison-9-0-0.txt

These .txt files are included for convenience. Then, run "ctfp_comparison-tab.R" to produce the values in Table 2.


########################
Figure 4: Run "ct-hom_comparison.R" to produce "ct-hom_comparison.txt". Then, run "ct-hom_comparison-fig.R" to produce 
"ct-hom_comparison.tex" via the R package "tikzDevice". This generates tikz code for Figure 4. For drawing, 
"ct-hom_comparison.tex" is imported into the main manuscript.


########################
Table 3: Raw public use data file is "ggn.dta", extracted from the replication kit 

	http://www.nber.org/~notom/ggn-replication-kit.zip

provided by Garthwaite, Gross, and Notowidigdo (Quarterly Journal of Economics, 129(2), 2014). Run "ggn_replication.R" 
to obtain Table 3, which also reproduces relevant estimates from Table II.A of Garthwaite, Gross, and Notowidigdo.




