This repository contains the Jupyter notebooks required to replicate the results in the paper "Tail Risk Exposure and the Cross-Section of Expected Stock Returns", along with additional results presented in the supplemental appendices. Each figure and table is generated and plotted in different notebooks with step-by-step instructions.
The repository consists of a series of notebooks, numbered in order of execution, but each can be run independently. However, some analyses (such as 6_Summary_Statistics, 7_Portfolio_Analysis, and 8_Regression_Analysis) require the final sample to generate results.
-
1_Simulations.ipynb
- Simulates data for analysis.
-
2_Import_Factor_Data.ipynb
- Imports common factor data from external sources.
-
3_Estimators_Functions.ipynb
- Defines functions for risk factor estimation based on daily return data.
-
4_Process_Daily_Returns_Factors.ipynb
- Downloads and computes risk factors (daily return-based) using WRDS data.
-
5_Process_Monthly_Returns_Factors.ipynb
- Downloads and computes risk factors (monthly return-based) from WRDS data and saves the final sample.
-
6_Summary_Statistics.ipynb
- Produces summary statistics tables, correlation tables, persistence measures, and trends of Tail Risk Exposure variables.
-
7_Portfolio_Analysis.ipynb
- Generates results tables and figures for univariate and bivariate portfolio sorting strategies.
-
8_Regression_Analysis.ipynb
- Computes and presents Fama-MacBeth regression results tables.
- estimation_mixture.py
- Implements the methodology for estimating Tail Risk Exposure, following Chabi-Yo et al. (2018)
The notebooks 4_Process_Daily_Returns_Factors.ipynb and 5_Process_Monthly_Returns_Factors.ipynb require access to a WRDS account with API access. Users must insert their WRDS credentials in these notebooks:
os.environ['WRDS_USERNAME'] = '...'
os.environ['WRDS_PASSWORD'] = '...'The following Python libraries are required:
pip install pandas numpy matplotlib ipython wrds scipy statsmodels linearmodels pycop pandarallelpandasnumpymatplotlibIPythonwrdsscipystatsmodelslinearmodelspycoppandarallel(highly recommended for parallel processing, but not mandatory)