forked from llorracc/cAndCwithStickyE
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.tex
106 lines (74 loc) · 9.62 KB
/
README.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
% !TeX spellcheck = en_GB
\documentclass[12pt,pdftex,letterpaper]{article}
% \usepackage{setspace}
\usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display
% \usepackage{lscape}
% \usepackage{latexsym}
% \usepackage{endnotes}
% \usepackage{epsfig}
% \singlespace
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}
\addtolength{\topmargin}{-\topmargin}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\addtolength{\headsep}{-\headsep}
\addtolength{\topskip}{-\topskip}
\addtolength{\headheight}{-\headheight}
\setcounter{secnumdepth}{2}
% \renewcommand{\thesection}{\arabic{section}}
% \renewcommand{\footnote}{\endnote}
\newtheorem{proposition}{Proposition}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{lemma}
\newtheorem{corollary}{Corollary}
\newtheorem{assumption}{Assumption}
\newcommand{\Prob}{\operatorname{Prob}}
\clubpenalty 5000
\widowpenalty 5000
\renewcommand{\baselinestretch}{1.25}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bbm}
\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}}
\newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}}
\begin{document}
\begin{center}
\textbf{Archive Notes for ``Sticky Expectations and Consumption Dynamics''} \\ May 21, 2019
\end{center}
This zip archive contains all files needed to replicate all results, tables, and figures in the paper and appendices. The contents of this archive are also available as a \texttt{git} repository at \texttt{https://github.com/llorracc/cAndCwithStickyE}. We first present short instructions for running our code on your own computer; a description of the archive's directory and file structure follows. All instructions assume that you have unpacked the contents of this archive onto your own computer, preserving the internal directory structure. All directories are relative to the root of this archive.
\vspace{0.5cm}
\noindent \textbf{Replicating the manuscript:} To produce a pdf version of the paper, simply open a terminal, navigate to the root directory of this archive, and run \texttt{pdflatex cAndCwithStickyE.tex}. The main paper is cross-referenced with the appendix, so you will need to compile the main paper, then the appendix \texttt{cAndCwithStickyE-App.tex}, then the main paper again.
\vspace{0.5cm}
\noindent \textbf{Replicating all results:} Nearly all of our results are produced using Python, but some empirical results use Stata. To replicate all of the tables, figures, and results that appear in the paper (and its appendices):
\begin{enumerate}
\item Install Python on your local computer. We recommend using Anaconda, a distribution of Python for scientific computing. The code has been fully tested on both Python 2 and Python 3, but official support for Python 2 will end on January 1, 2020, so we recommend that you use Python 3.
\item Open a terminal window (on Windows, use the Anaconda terminal; on Mac or Linux, an ordinary terminal window will work) and navigate to the root of the archive. Run \texttt{pip install -r requirements.txt}. This will add necessary Python packages to your computer if they are not already present. In particular, it will install the \texttt{HARK} package, the modeling framework used for this paper.
\item Open \texttt{./USER\_OPTIONS.py} and set three simple options there; defaults work fine on all computers. These options indicate whether figures should be displayed during execution, whether to use Stata to compute some statistics for which no Python package exists, and the absolute path to the Stata executable on your computer.
\item Run \texttt{python ./do\_all.py}. If you want to use a graphical environment like IPython and have installed Anaconda, run Spyder, open this file, and click the green arrow ``run'' button. Executing this file will take 1-2 days and requires 32 GB of RAM.
\end{enumerate}
If you want to run the code but don't want to wait two days for it to finish, the files \texttt{./do\_min.py} and \texttt{do\_mid.py} run much more manageable subsets of our results. Running \texttt{./do\_min.py} takes about one minute (a bit longer if using Stata to run the regressions) and produces results for the representative agent model in the appendix; running \texttt{do\_mid.py} produces results for our main specification in the text and takes about 30 minutes.
Each of these files specifies particular options and then runs \texttt{./Code/Models/StickyE\_MAIN.py}. To do a custom execution of our main code, open \texttt{./do\_custom.py} and edit the options there; detailed instructions of each model option are presented in that file. You need not ever open Stata manually to produce any of our results; if the work requires Stata, Python will make a shell call to open Stata and run the appropriate script (\texttt{.do} file).
\vspace{0.5cm}
\noindent \textbf{Directory and file structure:} Here we present an overview of the directories and files in this archive. We do not list all files individually, but have provided enough information for you to navigate and understand the structure.
\begin{itemize}
\item \texttt{./Calibration/} contains several small .txt files that define individual exogenous (calibrated) parameters for our models. These are read in by the Python code in \texttt{./Code/Models/StickyEparams.py} to calibrate the models and produce the calibration table in the paper.
\item \texttt{./Code/} contains two subdirectories:
\begin{itemize}
\item \texttt{./Code/Empirical/} contains Stata code for producing the U.S. empirical regressions reported in the paper. The script \texttt{\_usConsDynEmp.do} can be run to produce the .tex files for this table, which are saved to \texttt{./Tables}. The script uses the dataset \texttt{usData\_20170927.xlsx} stored in the folder \texttt{./Code/Empirical/data/} and calls the other scripts found here. The data are public, from NIPA of the Bureau of Economic Analysis and from Federal Reserve's Financial Accounts (and can be refreshed using the Haver database). The Excel file \texttt{usData\_20170927.xlsx} contains sheet \texttt{New\&Old} with a description of all series.
\item \texttt{./Code/Models/} contains (mostly) Python code for solving, simulating, and processing the results of our models into LaTeX tables and figures for the paper. Each execution run of our model(s) runs \texttt{StickyE\_MAIN.py} in Python; however, this file cannot be run independently, as it requires several variables (specifying runtime options or model specifications) to be defined first. These variables are defined by each of \texttt{./do\_min.py}, \texttt{./do\_mid.py}, and \texttt{./do\_all.py}, calling on small options scripts in \texttt{./Code/Models/Options/} to pre-specify some standard choices; all of the options can be set manually by editing \texttt{./do\_custom.py}. The file \texttt{StickyEmodel.py} contains the solution and simulation code for the models themselves, extending several of the models in the \texttt{HARK} package, while \texttt{StickyEtools.py} has functions for processing simulated data and producing the tables and figures in the paper. The Stata script \texttt{StickyETimeSeries.do} is called from the main code when the \texttt{use\_stata} option is set to \texttt{True}; this enables the calculation of the Hansen J statistic, which is unavailable in any Python package we could find. Simulated time series datasets and other intermediate results produced by the main code are saved to files in \texttt{./Code/Models/Results/}.
\end{itemize}
\item \texttt{./Equations/} contains many very small .tex files that are produced automatically when compiling the main paper .tex file, each containing the LaTeX code for one equation. These are used in the production of the HTML version of the paper.
\item \texttt{./Figures/} contains all figures produced for this paper, each in several formats: high resolution vector graphics PDFs, rasterized and compressed JPGs, rasterized and uncompressed PNGs, and alternately formatted vector graphics SVGs. All graphics files are produced by running \texttt{./do\_all.py} except \texttt{parkerExperiment.*}, which is produced by the Stata script \texttt{drawParkerChart.do} here.
\item \texttt{./Highlighted/} Contains several .tex files that are automatically generated when the main paper is compiled; each one is a small snippet of the paper.
\item \texttt{./LaTeX/} contains .tex files for the various appendices, and some subcomponents of the main paper. These are automatically read in when compiling \texttt{./cAndCwithStickyE.tex} and will not compile as standalone files.
\item \texttt{./Revision/} contains a small .tex file that adjusts notation from its defaults in authors' style files.
\item \texttt{./Slides/} contains tex files for constructing beamer slides for academic presentations.
\item \texttt{./Tables/} contains many tex files produced by the Python and Stata code with individual tables for the paper, along with additional specifications that we ran but did not report in the paper. These tex files are automatically incorporated in the paper when \texttt{./cAndCwithStickyE.tex} is compiled. In many cases, different version of the same table are produced for the paper and slides.
\end{itemize}
\end{document}