Prepare_and_run_replication - labordynamicsinstitute/replicability-training GitHub Wiki
Prepare and run the replication
- Carefully read the README provided with the replication materials.
- Follow the instructions for running the code.
Config file
It will be useful to include the config file provided with the LDI replication template files (see the example in the template):
-
Depending on the software being used, create a configuration file with the following names:
- Stata:
config.do
- R:
config.R
- Matlab:
config.m
- Stata:
:warning: You must change the name of config file from template-config.do
to config.do
and delete unnecessary lines!
- Add the basepath for the replication materials
For Stata, remember to use forward slashes ("/"), even on Windows. The R function
file.path()
will do this automatically.
Stata: global pwd "/path/to/base/directory";
R: pwd <- file.path("path","to","base","directory")
Matlab: (NEED EXAMPLE)
- Check if the author's programs create a logfile (i.e. are there .log files in the deposit?). If not, add sample code to create such a logfile to the "config" file (the template config file already contains code for this):
- Stata:
local pwd : pwd
local c_date = c(current_date)\
local cdate = subinstr("`c_date'", " ", "_", .)\
log using "`pwd`/logfile_`cdate'.log", replace text
The replication itself
- Continue to follow instructions in the README or the main program.
- Whenever the authors use a filepath, use the basepath macro you created in config.do
- For this to work, you need to call your "config.do" file within the author's script.
- Stata example: the line
use "C:\Documents\Author\data\thisfile.dta"
becomes
do "config.do"
use "${basepath}/data/thisfile.dta"
- R example:
source("config.R",echo=TRUE)
- Matlab :
NEED EXAMPLE
- Commit all the changes you made to make the code work: Example of commands::
git status
git add *log
git add programs/table1.do
git add programs/figure10.do
git commit -m "All the changes I made to make the code work on the system"
git push origin master
- Also: Important to keep note in REPLICATION.md about whether you change the directory, or any issue/progress you make on the replication.
Capturing output
Programs may generate output in a variety of formats. Typing
git status
will show you any new files that were not previously there, or that were modified, after each program run.
Datasets
Some programs generate datasets. You should treat those as any other datasets as well - i.e., if your instructions are to NOT save them, then don't.
Tables
Tables may be output as csv
files, Excel files, Latex files, etc. You should git add
these, as they are evidence of your replication, and your assessment in the REPLICATION.md.
Figures
Figures may be output in many ways, including on-screen only.
- See if PDF, PNG, EPS, or JPEG files are output by the program
- If not, see if the on-screen display in the program (Stata, Matlab, etc.) has an option to save, and save in PNG or PDF format
- If all else fails, do a screenshot, and save the screenshot (possibly cropped), with the name of the figure it is supposed to represent (e.g.,
Figure1.png
). - All figures should be placed in the Bitbucket repo through a
git add
,git commit
,git push
sequence.
You are not quite done yet
:arrow_forward: Write your replication report.