DOI: 10.3886/e154781v1-145921
title: Data and Code for: Measuring Geopolitical Risk

description: <b>Overview</b><br><br>This archive contains the files to reproduce the results in "Measuring Geopolitical Risk" as well as 
 any additional documentation referred in the paper. <br><br>Each directory is self-contained. For each directory, download all the files in order to run the necessary scripts. Instructions are given in the README files.<br>Updated data can be found
 on the geopolitical risk index webpage, which can be found at the following url: https://www.matteoiacoviello.com/gpr.htm<br><br>
 
For questions or comments, please contact iacoviel@gmail.com<br><br><br><br><br><b>Data Availability Statement</b><br><br>All the data used in this paper are provided in this repository, with the exception of the Compustat quarterly firm-level data, which can be downloaded from https://wrds-www.wharton.upenn.edu/pages/ with a registered account.<br><br><b>Software used</b><b><br></b>

The codes here run and have been tested either on
Stata/MP 16.0 (for *.do files), on Matlab R2019/A (for *.m files), on R Version 4.04 (for *.R files), and on Anaconda 3 (for
*.py, *.ipynb files). Most codes run in seconds/minutes on a personal
laptop with 16GB ram, with the exception of the R code
to estimate disaster episodes, which takes about 2 days using the standard
settings from the Nakamura et al (2013) paper (nIter = 50,000, nRuns = 40). 

<br><br><br><br><br><b>Directory list and list of main input files - if any - in each directory</b><br><br>1. Monthly Geopolitical Risk Data Used in the Paper (<b>data_paper</b>)See README.txt file in the directory for details<br>data_gpr_export.dta (Stata format)<br>data_gpr_export.xls (Excel format)<br><br>2. Replication of Section I: Tables 1-2, Figures 1-8, Appendix Tables A.3-A.6, and Appendix Figures A.1-A.4 and A.10-A.14 (<b>figures_paper</b>) <br>(requires Stata)<br><br>See README.txt in the directory for details<br><br>input file: run_figures_tables.do<br>3. Replication of Section III : VAR Evidence - Figures 9-10 and Appendix Figures A.5-A.7 (<b>var_results</b>)(requires Matlab)<br><br>See README.txt in the directory for details<br>input file: run_all.m<br>4. Replication of Section IV : Country-Specific GPR and Disaster Probability and Quantile Regressions - Tables 3-4 (<b>disaster_regressions</b>)(requires Stata)<br>See README.txt in the directory for details<br>input file: run_replication_country_gpr.do<br><br>5. Replication of Section V : Firm-Specific Geopolitical Risk - Table 5, Figure 11, Appendix Table A.7, and Appendix Figure A.9 (<b>firm_regressions</b>)(requires Stata)<br>See README.txt file in the directory for details.<br>input file: run_replication_firm_shuffled.do<br><br>(Note that replication of the results here requires downloading firm-level balance sheet data through Compustat/WRDS. See firm_documentation below for instructions on how to build the firm_level.dta file)<br><br>6. Auxiliary Material (Section V): Construction of Industry-Specific Exposure to Geopolitical Risk - Appendix Figure A.8 (<b>industry_regressions</b>)(requires Stata)<br><br>See README.txt file in the directory for details.<br>input file: run_replication_industry.do<br><br>7. Auxiliary Material: Documentation on how to Build the firm_level.dta file (<b>firm_documentation</b>)See README_BUILD.txt file in the directory for details.<br><br>8. Auxiliary Material (Section II): Tabulations of Daily Narrative GPR Data from The New York Times <b>(narrative_index)</b>See README.txt file in the directory for details.<br><br>9. Appendix: Details on the Construction of the Human GPR Index (<b>human_index</b>)See README.txt file in the directory for details.<br><br><br>10. Appendix: Audit of Articles Belonging to the GPR Index Described in Appendix Table A.3 (<b>audit_coded</b>)See README.txt file in the directory for details.<br><br><br>11. Appendix: Granger Causality Tests --- Appendix Table A.8 (<b>granger_causality</b>)(requires Stata)<br><br>See README.txt file in the directory for details.<br><br>input file: run_granger_test.do<br>12. Appendix: Replication of Textual Analysis in Appendix Tables A.1 and A.2 (<b>text_analysis</b>)(requires Matlab, including text analytics toolbox, and Stata for generating the formatted tables in the appendix)<br><br>See README.txt file in the directory for details.<br>input files: run_find_grams_textanalytics.m and run_app_tables_1_2.do <br>13. Auxiliary Material: Estimation of the Country Disaster Events from 1900 through 2019 (<b>disaster_estimation</b>)(requires R)<br><br>See README.txt file in the directory for details.<br><br><br>14. Auxiliary Material: Stata File with Firm-Level Geopolitical Risk Data (<b>firm_level_gpr</b>)See README.txt file in the directory for details.<br><br><br>15. Auxiliary Material: Search Queries for News-Based GPR Index (<b>news_searches</b>)See README.txt file in the directory for details.<br><br>16. Auxiliary Material: Search Queries for Firm-Level GPR Index (<b>firm_level_searches</b>)(requires Anaconda)<br><br>See README.txt file in the directory for details.<br><br><br><br><br><br>
description: United States, Advanced and Emerging Economies, Firms in the United States<br>. Smallest Geographic Unit: country
description: other;