\documentclass[a4paper,12pt]{article}
\usepackage{fullpage}
\usepackage{varioref}
\usepackage{dcolumn,booktabs}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{epstopdf}
\usepackage[longnamesfirst]{natbib}
\usepackage{hyperref}
\usepackage[dvips]{xy}
\usepackage{graphicx}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{placeins}
\usepackage{pdfpages}
\usepackage{amsthm}
\usepackage{tabularx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\renewcommand{\arraystretch}{1.2}
\graphicspath{{../Matlab/JEEA/Outputs/}{../ABB/FICA/}{../ABB/Equivs/}{../../../../Dropbox/VM/ABB/Figures/}{../ABB/Incomedefs/}{../../../../DB/Dropbox/VM/ABB/Figures/}}
\usepackage{lmodern} % load a font with all the characters
% The three previous ones are to type accents normally
\usepackage[margin=1in]{geometry}
\renewcommand{\arraystretch}{1.5}
\newtheorem{theorem}{Theorem}
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newcounter{Corollary}
\newtheorem{corollary}[Corollary]{Corollary}
\newtheorem{criterion}[theorem]{Criterion}
\newtheorem*{definition}{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newcounter{Lemma}
\newtheorem{lemma}[Lemma]{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
\newcounter{Proposition}
\newtheorem{proposition}[Proposition]{Proposition}
\newcounter{Remark}
\newtheorem{remark}[Remark]{Remark}
\newtheorem{solution}[theorem]{Solution}
\newtheorem{summary}[theorem]{Summary}
% \newenvironment{proof}[1][Proof]{\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\renewcommand{\cite}{\citet}
\newcommand{\sgn}{\operatorname{{\mathrm sgn}}}
%Now change font
\usepackage{helvet}
%\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\abstractname}{\normalsize Abstract}

\newcounter{romnum}
\newcounter{alphnum}
\newenvironment{romlist}{\setcounter{romnum}{0}\begin{list}{(\roman{romnum})}
{\usecounter{romnum}}}{\end{list}}
\newenvironment{alphlist}{\setcounter{alphnum}{0}\begin{list}{(\alph{alphnum})}
{\usecounter{alphnum}}}{\end{list}}
\newcommand{\linespacing}[1]{\renewcommand{\baselinestretch}{#1}\large \normalsize}


\begin{document}
\linespacing{1.5}

\section{Replication materials for "Nonlinear household earnings dynamics, self-insurance, and welfare"}

This readme file contains the information for the replication of the
results provided in the paper. The code is structured in three folders:

\begin{enumerate}
\item \textbf{Earnings} folder. Contains all the information necessary
  to generate the nonlinear (NL) and canonical earnings processes from
  the PSID data.
\item \textbf{Processes} folder. This folder contains the Markov chains
  for the NL process obtained using the procedure described in the
  Earnings folder.
\item \textbf{Model} folder. This folder contains the code for our structural model, that takes the earlier earnings processes as inputs.
\end{enumerate}

Please contact gonzalo.pardo.13@ucl.ac.uk if any difficulties arise using this material or if you have found a potential bug.

% Users can use these directly for their specific implementations
%To reproduce the paper precisely, the user needs to input PSID data with the transformations described in Section \ref{sec:psidtransformation}, and to use the code provided in Arellano, Blundell and Bonhomme (2017, Econometrica), which at the time of writing could be accessed \hyperlink{https://drive.google.com/open?id=1sy1OnA0tbmvGr_UgsudfBepee3XsHUmZ}{here}.

\section{Earnings folder}

\subsection{PSID data} \label{sec:psidtransformation}

We use the publicly available PSID data, as described in Appendix A. Due to the PSID Conditions of Use, we are unable to directly provide the dataset, but interested users can download it free of charge from \url{https://psidonline.isr.umich.edu/} .
Before loading the data to psid\_transformation.R, we perform the following sample cleaning procedures and generate a panel.

\begin{enumerate}
\item Keep only households that are members of the SRC sample.
\item Link them over time, following the same household head.
\item Restrict the sample to 25-60 year-olds, and all waves before 1993.
\item Correct inconsistent ages. Whenever the age of a head of household does not evolve as expected in year $t$, verify if it can be reconstructed with information from $t-1$ and $t+1$. Otherwise, drop the observation.
\item Other standard variable cleaning (eliminate 9999 that represent don't knows, etc.).
\end{enumerate}

\subsection{Transforming PSID data}

The code psid\_transformation.R takes as input the cleaned PSID sample and shows:

\begin{enumerate}
\item The construction of asset income. All variables have been given intuitive names, and their precise relationship with PSID variables is available upon request.
\item The deflation of all monetary variables using the CPI-U to 2013 prices.
\item The construction of taxes, and disposable labor income.
\item The transformation of the sample to serve as an input to the \citet{ABB2017} procedure.
\item The computation of the variances of log earnings following
  \citet{Kaplan_qe12} approach to remove time effects, as described in
  Appendix B, and also Figure B.1.
\item The generation of Figures 1 and C.1 (function incomedefs.R).
\end{enumerate}

\subsection{NL process}

\subsubsection{Applying the ABB method}

The code required for the application of the \citet{ABB2017} estimation
is available on those authors' websites. At the time of submission it
could be accessed
\hyperlink{https://drive.google.com/open?id=1sy1OnA0tbmvGr_UgsudfBepee3XsHUmZ}{here}.

In ABB\_coeffiCients.Xlsx (``Processes'' folder) we report our estimated coefficients. They are estimated for 11 quantiles which are equally spaced (from 1/12=0.0833 to 11/12=0.9167).

The code provided by ABB generates Figure 2, 5b, 10, and D.4. The file abb\_addition.m can be added to the ABB files to compute the statistics required for Figures 3 to 5.

The files eta\_sample.txt and eps\_sample.txt are the specific outputs
from the ABB routine, which we use as an input to dfp\_matrices.R

\subsubsection{Discretizing the simulated sample}

The file dfp\_matrices.R allows to discretize any earnings sample, either after a transitory-permanent decomposition or directly from earnings data.

In the folder "Processes" we report the state spaces for the persistent
component (eta\_space), transitory component (eps\_space), and the
transition matrices for the persistent component (eta\_tranmatrices),
that represent the input to the structural model. The subfolder
"Decompositions" includes the same state spaces and transition matrices
for each of the decompositions discussed in Section 6.

\subsection{Canonical process}

The file sty\_boot.m estimates the canonical earnings process by GMM
and, via a bootstrap procedure, computes its standard errors. It takes
as input the file psidsample\_boot.csv, which is generated by
psid\_transformation.R and contains the relevant targeted variances (see
point 5. in Section 2.2. above). This provides the information in Table
1.

\subsection{Other elements and figures}

The file varcons\_variances\_cex.R provides the code to compute the
variances of log consumption following \citet{Kaplan_qe12} approach to
remove time effects, using the CEX data available in \citet{HPV10} (not
provided).

The file more\_graphs.R generates Figure 3(d), with all inputs provided, and Figures D.1. to D.3. and D.5.

\section{Processes folder}

This folder contains the crucial outputs from the ``Earnings'' section that serve as an input for the ``Model'' section. Users interested in the direct use of our provided state spaces and transition matrices can find related information inside the folder.

\section{Model folder}

The file main.m (and associated files in \textit{mfiles}) contains the replication code for our structural model. It generates files with the key statistics for the graphs (in folder \textit{Outputs}, provided) and simulations for the computation of the BPP coefficientes (also in folder Outputs, not provided to reduce size). All inputs for main.m are provided.

The file generate\_graphs.m generates Figures 6, 7, 8, 9, D.6, D.7, and
D.8 and Tables 3 and 4. All inputs are provided.

bpp\_coefficients.R computes \citet{BPP08} insurance coefficients from a given earnings sample. It therefore generates Table 2 and Figure 11, and can be adjusted to generate Tables D.1. to D.3. It takes the simulations generated by main.m as input.

%
%
%A roadmap for the results and files is:
%
%\begin{enumerate}
%\item Begin from PSID data.
%\item Transform PSID data to impose sample selection restrictions, account for taxes, and equivalize to generate a clean sample. Material for this section is provided in psid\_transformation.R
%\item Apply the Arellano, Blundell, and Bonhomme (2017) method to the transformed sample, using the codes available from the Econometrica website. This part has two stages:
%\begin{enumerate}
%\item Estimate the coefficients $a$ in equations 6, 7, and 8, and the tail coefficients $\lambda^i_1, \lambda^i_L$ described in Section 3.2. of our JEEA paper.
%\item Simulate a large number of agents given the estimated parameters.
%\end{enumerate}
%\item Discretize the simulated sample using the discretization method described in Section 4 for our paper. This is obtained with file dfp\_matrices.R
%\item Input the state spaces and transition matrices obtained with this method (available in the "Processes" folder) to the life-cycle structural model (Matlab folder).
%\end{enumerate}

\bibliographystyle{../../agsmmod}
\bibliography{../../GonzaloBiblio}

\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
