\documentclass[11pt]{article}

\usepackage{amsmath,amsthm,amssymb}
\usepackage{cancel}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
% \usepackage{listings}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage[procnames]{listings}

\lstset{language=Python,
        basicstyle=\ttfamily\small,
        keywordstyle=\color{keywords},
        commentstyle=\color{green},
        stringstyle=\color{red},
        showstringspaces=false,
        identifierstyle=\color{black},
        procnamekeys={def,class}}

\newenvironment{theorem}[2][Theorem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{lemma}[2][Lemma]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{exercise}[2][Exercise]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{question}[2][Question]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{corollary}[2][Corollary]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}

\newcommand{\E}{\mathbb{E}}
\newcommand{\argmin}{\operatornamewithlimits{argmin}}
\newcommand{\argmax}{\operatornamewithlimits{argmax}}

\newcommand{\der}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\sumin}[]{\sum_{i = 1}^{n}}


\begin{document}


%%%%% Extra commands that might be useful later
% \newcommand{\ssection}[1]{%
%   \vspace{0.35in} {\hspace{-1.5em}\large\bf #1}}

% \newenvironment{theorem}[2][Theorem]{\begin{trivlist}
%   \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
% \newenvironment{lemma}[2][Lemma]{\begin{trivlist}
%   \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
% \newenvironment{corollary}[2][Corollary]{\begin{trivlist}
%   \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%	Homework title, name, and date
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

{\noindent Instructor: \textit{Professor Griffy}\\ Due: \textit{May 5th, 2022}\\ AECO 701}

\begin{center} \Large Problem Set 6: The Heterogeneous Agent Model \end{center} \vspace{1em}

% --------------------------------------------------------------
% --------------------------------------------------------------

% \vspace{.5em} \noindent \textbf{The RBC Model}

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{problem}{1} \textbf{Huggett Model.} On the campus cluster, you will find code to solve the Aiyagari model with a labor-leisure choice. Please start from that code (email me if you cannot access the cluster). The Huggett (1993) Model is given by

  \begin{equation}
    V(a,\epsilon;\psi) &= u(c) + \beta E[V(a',\epsilon';\psi')]
  \end{equation}

subject to

\begin{align}
  c + a' &\leq (1 + r(\psi))a + \epsilon\\
  \epsilon&\sim \text{\it Markov}, \Pi(\epsilon'|\epsilon)\\
  \psi' &= \Psi(\psi)
\end{align}

Assume the following calibration:

\begin{center}
 \begin{tabular}{||c c||}
 \hline
 Parameter & Value   \\ [0.5ex]
 \hline\hline
 $u(c)$ & $\frac{c^{1 - \sigma}}{1 - \sigma}$  \\
 \hline
 $\beta$ & 0.993  \\
 \hline
 $\sigma$ & 1.5  \\
 \hline
   a' &$\geq$ -2 \\
 \hline
\text{a grid} & [-2, 12]\\
 \hline
\text{a nodes} & 100\\
 \hline\hline
\end{tabular}
\end{center}

\begin{equation} \pi_{t} =
\begin{bmatrix}
  0.925 & 0.075 \\ 0.5 & 0.5
\end{bmatrix}
\end{equation}

\begin{equation} \epsilon =
\begin{bmatrix}
  1.0 \\ 0.1
\end{bmatrix}
\end{equation}

Note that market clearing is given by

\begin{equation}
  \int_{a\times\epsilon}a'd\psi = 0
\end{equation}

\end{problem}

  \begin{enumerate}

  \item Solve the model. Plot the decision rules for savings across the a grid for an agent in employment state 1 and employment state 2.

  \item Plot the stationary distribution of wealth.

  \end{enumerate}
\newpage
\begin{problem}{2} \textbf{Aiyagari Model.} Now we will extend the problem to include a firm, as in Aiyagari (1994). In this economy, the household's problem is given by

  \begin{equation}
    V(k,l;\psi) &= u(c) + \beta E[V(k',l';\psi')]
  \end{equation}

subject to

\begin{align}
  c + k' &\leq (1 + r(K,L) - \delta)k + w(K,L)l\\
  k' &\geq 0 \\
  ln(l') &= \rho ln(l) + \sigma(1 - \rho^{2})^{\frac{1}{2}}\epsilon',\;\epsilon\sim N(0,1)\\
  \psi' &= \Psi(\psi)
  % K &= \int_{k\times l}k'd\psi\\
  % L &= \int_{k\times l}l d\psi\\
\end{align}

and the firm's problem is given by

\begin{align}
  \Pi = \max_{K,L} F(K,L) - r(K,L)K - w(K,L)L
\end{align}

\end{problem}

Assume the following calibration:

\begin{center}
 \begin{tabular}{||c c||}
 \hline
 Parameter & Value   \\ [0.5ex]
 \hline\hline
 $u(c)$ & $\frac{c^{1 - \mu}}{1 - \mu}$  \\
 \hline
 $F(K, L)$ & $K^{\alpha}L^{1 - \alpha}$  \\
 \hline
 $\beta$ & 0.96  \\
 \hline
 $\delta$ & 0.08 \\
 \hline
 $\alpha$ & 0.36 \\
 \hline
\text{k Grid} & [0, 18]\\
 \hline
\text{k nodes} & 100\\
 \hline\hline
\end{tabular}
\end{center}

% \begin{equation} \pi_{t} =
% \begin{bmatrix}
%   0.925 & 0.075 \\ 0.5 & 0.5
% \end{bmatrix}
% \end{equation}

% \begin{equation} \epsilon =
% \begin{bmatrix}
%   1.0 \\ 0.1
% \end{bmatrix}
% \end{equation}

Note that market clearing is given by

\begin{align}
  \int_{k\times l}ld\psi = L\\
  \int_{k\times l}k'd\psi = K
\end{align}

and that $\mu$, $\sigma$, and $\rho$ will be given in the following parts.

  \end{problem}

  \begin{enumerate}

  \item Use Tauchen's method to approximate the AR(1) process for $\rho = 0.6$ and $\sigma = 0.2$. Write out the resulting grid and transition matrix.

  \item Find the ergodic distribution of employment using this grid and transition matrix. Call this $L$. Note that you will need to calculate this for each $\rho$, $\sigma$ pair.

  \item Solve the model. Plot the decision rules for savings across the k grid for $\rho = 0.6$, $\sigma = 0.2$, and $\mu = 3$.

  \item Plot the stationary distribution of wealth for $\rho = 0.6$, $\sigma = 0.2$, and $\mu = 3$.

  \item Now pick $\sigma = 0.4$ and plot the net return to capital for $\rho = \{0,0.3,0.6,0.9\}$ and $\mu = \{1,3,5\}$.

  \end{enumerate}

\end{document}
