DOI: 10.7910/dvn/mp6l5b
title: Hazardous Times

description: &lt;p&gt;This repository contains the replication package for the article &lt;strong&gt;"Hazardous Times: Animal Spirits and U.S. Recession Probabilities."&lt;/strong&gt; It includes all necessary R code, raw data, and processed data in the start-stop (counting process) format required to reproduce the empirical results, tables, and figures from the study.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Description:&lt;/strong&gt;&lt;br&gt;
The study assembles monthly U.S. macroeconomic time series from the Federal Reserve Economic Data (FRED) and related sources—covering labor market conditions, consumer sentiment, term spreads, and credit spreads—and implements a novel "high water mark" methodology to measure the lead times with which these indicators signal NBER-dated recessions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contents:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;strong&gt;Code:&lt;/strong&gt; R scripts for data cleaning, multiple imputation, survival analysis, and figure/table generation. A top-level master script (&lt;code&gt;run_all.R&lt;/code&gt;) executes the entire analytical pipeline end-to-end.&lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Data:&lt;/strong&gt;
 &lt;ul&gt;
 &lt;li&gt;&lt;code&gt;Raw/&lt;/code&gt;: Original data pulls from primary sources.&lt;/li&gt;
 &lt;li&gt;&lt;code&gt;Analysis_Ready/&lt;/code&gt;: Cleaned series, constructed cycle-specific extremes (high water marks), lead time variables, and the final start-stop dataset for survival analysis. The final curated Excel workbooks used as direct inputs for the replication code. &lt;strong&gt;(Note: These Excel sheets must be saved as separate &lt;code&gt;.xlsx&lt;/code&gt; files in the designated directory before running the R code.)&lt;/strong&gt;&lt;/li&gt;
 &lt;/ul&gt;
 &lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Documentation:&lt;/strong&gt; This README file and detailed comments within the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Details:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;strong&gt;Software Requirements:&lt;/strong&gt; The replication code is written in R. A list of required R packages (with versions) is provided in the reference list of the article. &lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Missing Data:&lt;/strong&gt; Addressed via Multiple Imputation by Chained Equations (MICE).&lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; The original raw data from FRED is subject to its own terms of use, which require citation. The R code is released under the MIT License. All processed data, constructed variables, and analysis-ready datasets created by the author are dedicated to the public domain under the CC0 1.0 Universal Public Domain Dedication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Instructions:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;Download the entire repository.&lt;/li&gt;
 &lt;li&gt;Install the required R packages.&lt;/li&gt;
 &lt;li&gt;Save Excel sheets from the workbook “Hazardous_Times_Data.xlsx” as separate .xlsx files in the designated directory before running the R code in step 4.&lt;/li&gt;
&lt;li&gt;Run the master script run_all.R to fully replicate the study's analysis from the provided Analysis_Ready data. This script will regenerate all tables and figures.&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;Users should consult the main publication for full context, theoretical motivation, and series-specific citations.&lt;/p&gt;