Data and Code for: Measuring Geopolitical Risk
收藏资源简介:
<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>
## 概述 本归档文件包含可复现《Measuring Geopolitical Risk》(《地缘政治风险测算》)一文研究结果的全部文件,以及论文中提及的所有补充文档。 每个目录均为独立完整的单元,如需运行对应目录下的必要脚本,请下载该目录下的全部文件。具体操作说明详见各目录内的README文件。 最新版数据可在地缘政治风险指数官网获取,网址为:https://www.matteoiacoviello.com/gpr.htm 如有疑问或建议,请致邮iacoviel@gmail.com。 ## 数据可用性声明 本文所用全部数据均已收录至本仓库,仅Compustat季度企业层面数据除外,该类数据需通过注册账户在https://wrds-www.wharton.upenn.edu/pages/下载获取。 ## 所用软件 本仓库内的代码已完成测试并可在以下软件环境中运行:针对*.do文件,适配Stata/MP 16.0;针对*.m文件,适配Matlab R2019/A;针对*.R文件,适配R 4.0.4版本;针对*.py与*.ipynb文件,适配Anaconda 3。多数代码在配备16GB内存的个人笔记本电脑上运行耗时仅为数秒至数分钟,但用于灾害事件估计的R代码除外:若采用Nakamura等人2013年论文中的标准设置(nIter=50000,nRuns=40),该代码运行耗时约为2天。 ## 各目录列表及对应目录下的主要输入文件(如存在)清单 1. 论文所用月度地缘政治风险数据(**data_paper**):详见该目录内的README.txt文件。包含文件:data_gpr_export.dta(Stata格式)、data_gpr_export.xls(Excel格式) 2. 第I部分复现:可复现表1-2、图1-8、附录表A.3-A.6以及附录图A.1-A.4与A.10-A.14的代码(**figures_paper**):需使用Stata运行,详见对应目录内的README.txt文件。输入文件:run_figures_tables.do 3. 第III部分复现:向量自回归(VAR)实证分析,包含图9-10与附录图A.5-A.7的复现代码(**var_results**):需使用Matlab运行,详见对应目录内的README.txt文件。输入文件:run_all.m 4. 第IV部分复现:国别特定地缘政治风险与灾害概率及分位数回归分析,包含表3-4的复现代码(**disaster_regressions**):需使用Stata运行,详见对应目录内的README.txt文件。输入文件:run_replication_country_gpr.do 5. 第V部分复现:企业层面地缘政治风险分析,包含表5、图11、附录表A.7以及附录图A.9的复现代码(**firm_regressions**):需使用Stata运行,详见对应目录内的README.txt文件。输入文件:run_replication_firm_shuffled.do。注:本部分结果复现需通过Compustat/WRDS下载企业层面资产负债表数据,具体构建firm_level.dta文件的操作说明详见下文的firm_documentation目录。 6. 辅助材料(第V部分):地缘政治风险行业特定敞口构建代码,包含附录图A.8的复现代码(**industry_regressions**):需使用Stata运行,详见对应目录内的README.txt文件。输入文件:run_replication_industry.do 7. 辅助材料:企业层面数据firm_level.dta的构建文档(**firm_documentation**):详见该目录内的README_BUILD.txt文件。 8. 辅助材料(第II部分):《纽约时报》每日叙事型地缘政治风险指数制表代码(**narrative_index**):详见对应目录内的README.txt文件。 9. 附录:人工地缘政治风险指数(Human GPR Index)的详细构建说明(**human_index**):详见对应目录内的README.txt文件。 10. 附录:附录表A.3所列地缘政治风险指数相关文章的审核编码文档(**audit_coded**):详见对应目录内的README.txt文件。 11. 附录:格兰杰因果检验(Granger Causality Tests)——附录表A.8的复现代码(**granger_causality**):需使用Stata运行,详见对应目录内的README.txt文件。输入文件:run_granger_test.do 12. 附录:附录表A.1与A.2的文本分析复现代码(**text_analysis**):需使用Matlab(需搭配文本分析工具箱)及Stata生成附录中的格式化表格,详见对应目录内的README.txt文件。输入文件:run_find_grams_textanalytics.m与run_app_tables_1_2.do 13. 辅助材料:1900年至2019年国家层面灾害事件估计代码(**disaster_estimation**):需使用R运行,详见对应目录内的README.txt文件。 14. 辅助材料:包含企业层面地缘政治风险数据的Stata文件(**firm_level_gpr**):详见对应目录内的README.txt文件。 15. 辅助材料:基于新闻的地缘政治风险指数搜索查询代码(**news_searches**):详见对应目录内的README.txt文件。 16. 辅助材料:企业层面地缘政治风险指数搜索查询代码(**firm_level_searches**):需使用Anaconda运行,详见对应目录内的README.txt文件。




