Skip to content

Latest commit

 

History

History
121 lines (90 loc) · 5.48 KB

File metadata and controls

121 lines (90 loc) · 5.48 KB

Overview

The code in this replication package performs analysis using one data source (Vargas (2021)) using R. A Master file runs all of the code to generate the data for the figures and tables in the paper. The replicator should expect the code to run for about 30 secs.

Data Availability and Provenance Statements

The data relied on in this paper can be found in the ‘./input’ folder of the repository and is described in the Table below:

Data File Source Provided Additional information
./input/agtpa_applications.rda (Vargas 2021) yes Data on intra- and International trade data collected from the applications in the manual of Yotov et al. (2016).

A codebook describing the variable labels for each included dataset is available in ‘./input/codebook.xlsx.’

Computing environment

This code was run on a x86_64-w64-mingw32 platform of a Windows 10 x64 (build 19044) computer.

The analysis is conducted in the R programming environment. R is free, open-source and available for download here. The code has been tested against R version R version 4.1.2 (2021-11-01).

Once R is successfully set up on your system, you will need to install a number of external R libraries. I have used renv to snapshot the project’s R environment. To install all of the necessary R libraries, simply open R at the project root (e.g. by clicking on the .Rproj file) and run the following commands:

## Run these commands in R

# install.packages("renv") ## Only necessary if the renv package is not yet installed on your computer
# renv::init()  ## Only necessary if you didn't open the repo as an RStudio project
renv::restore(confirm = FALSE)

If the renv command fails, you can alternatively install the necessary packages manually by running the R script ./code/01_packagemanagement.R.

Instructions to replicators

All code files in this repository are referred to through the package here(). This package finds the root as the place where the ‘.Rproj’ file is located. For this repository, the .Rproj file is located in the root folder, referred to as ‘./.’

The empirical data analysis takes place within the ./input, /code, and ./output directories respectively holding the external files, the code that operates on the files in the ./input directory, and the computational results. The structure of replication package is indicated in the `./code/00_MASTER.R’ file. Running this Master file will reproduce all the results of this analysis and assign these results to their respective output folders.

Further files and directories refer to:

  • The ./paper directory contains a sketch of the paper with numbered figures and tables.
  • The ./renv directory, along with the file ./renv.lock, captures the computational environment (see previous section)
  • The repository is dual-licensed (see ./LICENSE.txt). A Modified BSD License applies to all code, scripts, programs, and SOFTWARE while a Creative Commons Attribution 4.0 International Public License, applies to databases, images, tables, text, and any other objects.
  • The Readme files ./Readme.md, ./Readme.html, and ./Readme.docx are generated by ./Readme.Rmd. NOTE: It’s fine if your write your Readme file in Word!
  • The ./bibliography.bib and ./chicago-author-date-withnotes.csl files contain the bibliography in bibtex and the citation-style file.

Mapping of Tables and Figures to programs

A mapping of the Figures displayed in the paper to the respective programs can be found below:

Nr. Program Output Note
1 ./code/07_RTAs.R ./output/figures/fig_rta_evo.png

A mapping of the Tables displayed in the paper to the respective programs can be found below:

Nr. Program Output Note
1 ./code/05_TraditionalGravityEstimates.R ./output/tables/tab_traditional_gravity.tex
2 ./code/05_TraditionalGravityEstimates.R ./output/tables/tab_traditional_gravity.docx
3 ./code/06_DistancePuzzle.R ./output/tables/tab_distance_gravity.tex
4 ./code/06_DistancePuzzle.R ./output/tables/tab_distance_gravity.docx
5 ./code/07_RTAs.R ./output/tables/tab_rta_gravity.tex
6 ./code/07_RTAs.R ./output/tables/tab_rta_gravity.docx

References

Vargas, Mauricio. 2021. “Tradepolicy: Replication of ’an Advanced Guide to Trade Policy Analysis’.” https://github.com/pachadotdev/tradepolicy/blob/main/data/agtpa_applications.rda, Accessed on 02-March-2022.

Yotov, Yoto V, Roberta Piermartini, Mario Larch, et al. 2016. An Advanced Guide to Trade Policy Analysis​: The Structural Gravity Model. WTO iLibrary.