%----------------------------------------------------------------------------------------
%	PACKAGES AND THEMES
%----------------------------------------------------------------------------------------

\documentclass{beamer}

\mode<presentation> {

% The Beamer class comes with a number of default slide themes
% which change the colors and layouts of slides. Below this is a list
% of all the themes, uncomment each in turn to see what they look like.

\usetheme{default}
%\usetheme{AnnArbor}
%\usetheme{Antibes}
%\usetheme{Bergen}
%\usetheme{Berkeley}
%\usetheme{Berlin}
%\usetheme{Boadilla}
%\usetheme{CambridgeUS}
%\usetheme{Copenhagen}
%\usetheme{Darmstadt}
%\usetheme{Dresden}
%\usetheme{Frankfurt}
%\usetheme{Goettingen}
%\usetheme{Hannover}
%\usetheme{Ilmenau}
%\usetheme{JuanLesPins}
%\usetheme{Luebeck}
%\usetheme{Madrid}
%\usetheme{Malmoe}
%\usetheme{Marburg}
%\usetheme{Montpellier}
%\usetheme{PaloAlto}
%\usetheme{Pittsburgh}
%\usetheme{Rochester}
%\usetheme{Singapore}
%\usetheme{Szeged}
%\usetheme{Warsaw}

% As well as themes, the Beamer class has a number of color themes
% for any slide theme. Uncomment each of these in turn to see how it
% changes the colors of your current slide theme.

%\usecolortheme{albatross}
%\usecolortheme{beaver}
%\usecolortheme{beetle}
%\usecolortheme{crane}
%\usecolortheme{dolphin}
%\usecolortheme{dove}
%\usecolortheme{fly}
%\usecolortheme{lily}
%\usecolortheme{orchid}
\usecolortheme{rose}
%\usecolortheme{seagull}
%\usecolortheme{seahorse}
%\usecolortheme{whale}
%\usecolortheme{wolverine}

%\setbeamertemplate{footline} % To remove the footer line in all slides uncomment this line
%\setbeamertemplate{footline}[page number] % To replace the footer line in all slides with a simple slide count uncomment this line

%\setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{cancel}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{colortbl}
\usepackage[T1]{fontenc}
\beamertemplatenavigationsymbolsempty

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.multipart}
\newcommand{\der}[2]{\frac{\partial #1}{\partial #2}}

\makeatletter
\def\@listi{\leftmargin\leftmargini
            \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
            \parsep 0\p@
            \itemsep\fill}
\let\@listI\@listi
\makeatother

% \makeatletter
% \def\@listii{\leftmargin\leftmarginii
%             \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
%             \parsep 0\p@
%             \itemsep\fill}
% \let\@listI\@listii
% \makeatother

\makeatletter
\def\@listii{\leftmargin\leftmarginii
              \topsep    1ex
              \parsep    0\p@   \@plus\p@
              \itemsep   \fill}
\makeatother

\makeatletter
\def\@listiii{\leftmargin\leftmarginiii
              \topsep    1ex
              \parsep    0\p@   \@plus\p@
              \itemsep   \fill}
\makeatother

\makeatletter
\def\rowcolor{\noalign{\ifnum0=`}\fi\bmr@rowcolor}
\newcommand<>{\bmr@rowcolor}{%
  \alt#1%
  {\global\let\CT@do@color\CT@@do@color\@ifnextchar[\CT@rowa\CT@rowb}%
  {\ifnum0=`{\fi}\@gooble@rowcolor}%
}


\newcommand{\@gooble@rowcolor}[2][]{\@gooble@rowcolor@}
\newcommand{\@gooble@rowcolor@}[1][]{\@gooble@rowcolor@@}
\newcommand{\@gooble@rowcolor@@}[1][]{\ignorespaces}
\makeatother

%----------------------------------------------------------------------------------------
%	TITLE PAGE
%----------------------------------------------------------------------------------------

\title[]{Quantitative Macro-Labor:\\ Global Solution Techniques} % The short title appears at the bottom of every slide, the full
% title is only on the title page

\author{Professor Griffy} % Your name
\institute[University at Albany, SUNY] % Your institution as it will appear on the bottom of
% every slide, may be shorthand to save space
{
UAlbany  \ % Your institution for the title page
}
\date{Fall 2024} % Date, can be changed to a custom date

\begin{document}

\begin{frame}
  \titlepage % Print the title page as the first slide
\end{frame}




% ----------------------------------------------------------------------------------------
%	PRESENTATION SLIDES
% ----------------------------------------------------------------------------------------

%------------------------------------------------
\section{Introduction} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk
% ------------------------------------------------

\begin{frame}
  \frametitle{Announcements}
  \begin{itemize}
  \item Today: value function iteration.
  \item Using:
    \begin{enumerate}
    \item Grid search;
    \item Interpolation (grid search with functions filling in between nodes).
    \end{enumerate}
  \item Go through examples with MP94 model (code on cluster).
  \item Empirical regularities project due 11/5!
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Solving a Model}
  \begin{itemize}
  \item When we say ``solve a model'' what do we mean?
    \begin{enumerate}
    \item Find the equilibrium of the model.
    \item Generally, determine the policy functions.
    \item Determine the transition equations given the individual and aggregate state.
    \item i.e., aggregate up the policy functions and determine prices given distributions.
    \end{enumerate}
  \item Generically, this is hard: many states, non-linear decision rules, etc.
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Solving a Model}
  \begin{itemize}
  \item Generically, this is hard: many states, non-linear decision rules, etc.
  \item Much of quantitative macro is about finding ``shortcuts'' without sacrificing accuracy of solution (some we have seen):
    \begin{enumerate}
    \item Planner's problem: use welfare theorems to remove prices from problem.
    \item Rational expectations \& complete markets: Aggregate worker decision rules by assuming they make same predictions about future prices, and face same consumption risk.
    \item Exogenous wage distribution/prices: agents do not respond to decisions of other agents.
    \item Block Recursive Equilibrium: agents face an equilibrium with individual prices, i.e., no need to know distribution.
    \end{enumerate}
  \item Linearization: assume the economy is close enough to steady-state that transition equations (i.e., policy functions) are close to linear within small deviations.
  \item Value function iteration: discretize state space and solve model at ``nodes'' in state space.
  \end{itemize}
\end{frame}

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

\section{MP94 Model} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk

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

\begin{frame}
\frametitle{Discrete Mortensen and Pissarides (1994) Model}
\begin{itemize}
  \item iid productivity: draw $\epsilon\sim_{iid}F(\epsilon)$; evolve at rate $\lambda$
  \item Wages determined by Nash Bargaining (bargaining power $\alpha$).
  \item agg shocks Z, endogenous separations when $\epsilon < \epsilon_{d}$
  \item Value of unemployment:
\begin{equation*}
  \label{eq:U}
   U(z) = b + \beta [p(\theta)\int_{\underline{\epsilon}}^{\bar{\epsilon}}[\max\{W(x,z'),U(z')\}]dF(x) + (1 - p(\theta))U(z')].
\end{equation*}
\item Value of employment:
\begin{align*}
  \label{eq:W}\small
  \hspace{-10mm}   W(\epsilon,z) &= w + \beta E[\lambda\alpha\int_{\underline{\epsilon}}^{\bar{\epsilon}}[\max\{S(x,z'),0\} - S(\epsilon,z')] \; dF(x) \nonumber\\&+ (1 - \lambda)W(\epsilon, z')]
\end{align*}
\item $S(x,z)$: joint surplus of firm \& worker.
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Firms}\label{freeentry}
  \begin{itemize}
  \item Post vacancy at cost $\kappa$.
    \item Value of a filled vacancy:
{\small\begin{align*}
  \label{eq:J}
\hspace{-15mm}  J(&\epsilon,z) = e^{z}\epsilon - w + \beta E[\lambda(1 - \alpha)\int_{\underline{\epsilon}}^{\bar{\epsilon}}\max\{S(x,z'),0\} \; dF(x) \\&+ (1 - \lambda)J(\epsilon,z')]
\end{align*}}
    \item Value of unfilled vacancy:
\begin{align*}
  \label{eq:V}
  V(z) &= -\kappa + \beta E[q(\theta)\int_{\underline{\epsilon}}^{\bar{\epsilon}}[\max\{J(x,z'),V(z')\}]dF(x) \\&+ (1 - q(\theta))V(z')]
\end{align*}
\item Free entry ($V=0$)$\rightarrow$ match rate:   $q(\theta) = \frac{\kappa}{\beta E[\int_{\epsilon_{d}} J(x,z')dF(x)]}$
\item Market tightness: $\theta = q^{-1}(\frac{\kappa}{\beta E[\int J dF(x)]})$
  \end{itemize}
\end{frame}


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



\begin{frame}
  \frametitle{Surplus and Employment Thresholds}\label{freeentry}
  \begin{itemize}
  \item Impose matching func: $p(\theta) = A \theta^{1 - \eta}$
  \item Surplus $S(\epsilon,z) &= W(\epsilon,z) - U(z) + J(\epsilon,z) - V(z)$:
\begin{align*}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x) + (1 - \lambda)max\{S(\epsilon,z),0\} \nonumber\\&-A\theta^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x)]\\
  z' &= \rho z + \epsilon_{z},\;\epsilon_{z}\sim N(0,\sigma_{\epsilon})
\end{align*}
\item How are we going to solve this model?
\item Everything function of surplus.
\item Set up grid of $\epsilon$ and $z$.
  \end{itemize}
\end{frame}


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

\begin{frame}
\frametitle{Value Function Iteration}
\begin{itemize}
\item Basic approach to value function iteration:
\begin{enumerate}
\item Create grid of points for each dimension in state-space.
\item Specify terminal condition $S_{t}$ for $t = T$ at each point in state-space.
\item Solve problem of agent in period $T-1$: $S_{t}(\epsilon,z) = e^{z}\epsilon - b + \beta E[func(\epsilon_{d})]$.
\item $\epsilon_{d}(z)$ is policy function, which yields the point where $S_{t}(\epsilon_{d},z) = 0$
\item Check to see if function has converged, i.e., $|S_{t} - S_{t + 1}| < errtol\forall (\epsilon,z)$
\item Update $S_{t + 1} = S_{t}$
\end{enumerate}
\item Interpolation: same idea, but functions used to fill in between grid points.
\end{itemize}
\end{frame}

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

% \begin{frame}
% \frametitle{Parameter Values}
% \begin{itemize}
% \item From Fujita and Ramey (2012)
% \item They use c instead of $\kappa$
% \end{itemize}
% \centering\includegraphics[width=0.8\textwidth]{params.png}
% \end{frame}

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

\begin{frame}
\frametitle{Grids}
\begin{itemize}
\item Want: smallest grids reasonable.
\item Grids are both shocks, pick set number of standard deviations.
\item Approximate a continuous AR(1) process with a markov process:
\item Create grid of potential $z$ values $\{z_{1},...,z_{N}\}$, approximate AR(1) process through transition probabilities.
  \begin{align}
    E[z_{t}] &= E[\rho z_{t - 1} + \epsilon_{z,t}] = 0\\
    V[z_{t}] &= V[\rho z_{t - 1} + \epsilon_{z,t}] = \rho^{2}\sigma_{z}^{2} + \sigma_{\epsilon_{z}}^{2}\\
    \rightarrow (1 - \rho^{2})\sigma_{z}^{2} &= \sigma_{\epsilon_{z}}^{2}
  \end{align}
\item Define this process $G(\bar{\epsilon_{z}})$
\item Tauchen (1986):
  \begin{align}
    z_{N} &= m(\frac{\sigma_{\epsilon_{z}}^{2}}{1 - \rho^{2}})\\
    z_{1} &= -z_{N}\\
    z_{2},...,z_{N-1} &\text{   equidistant}
  \end{align}
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Expectations with AR(1) Process}
\begin{itemize}
\item Tauchen (1986):
  \begin{align}
    z_{N} &= m(\frac{\sigma_{\epsilon_{z}}^{2}}{1 - \rho^{2}})\\
    z_{1} &= -z_{N}\\
    z_{2},...,z_{N-1} &\text{   equidistant}
  \end{align}
\item Create an $n x n$ transition matrix $\Pi$ using probabilities
  \begin{align}
    \pi_{ij} &= G(z_{j} + d/2 - \rho z_{i}) - G(z_{j} - d/2 - \rho z_{i})\\
    \pi_{i1} &= G(z_{1} + d/2 - \rho z_{i})\\
    \pi_{iN} &= 1 - G(z_{N} + d/2 - \rho z_{i})
  \end{align}
\item Idiosyncratic shocks ($\epsilon_{z}$):
  \begin{itemize}
  \item Right way to do it: Gaussian Hermite Quadrature.
  \item Here: Same as above, set $\rho = 0$.
  \end{itemize}
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Endogenous Separations}
\begin{itemize}
\item Problem:
\begin{align*}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x) \nonumber\\&+ (1 - \lambda)max\{S(\epsilon,z'),0\} -A\theta^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x)]\\
  ln(z') &= \rho ln(z) + \epsilon_{z},\;\epsilon_{z}\sim N(0,\sigma_{\epsilon})
\end{align*}
\item Find $\epsilon_{d}(z)$ such that $S(\epsilon_{d},z) = 0$
\item $S_{0} = $? Safest bet to set it to zero at all $\epsilon,z$.
\item $\theta_{0} = $? Safest bet to set it to zero at all $\epsilon,z$.
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Value Function First Iteration}
\begin{itemize}
\item Intuitively, solve for surplus, find $\epsilon$ at which would like to separate for every $z$.
\item Calculate the following:
  \begin{align}
    e^{z}\epsilon_{1} - b &+ \beta \times 0\\
    e^{z}\epsilon_{2} - b &+ \beta \times 0\\
    \dots&\\
    e^{z}\epsilon_{N} - b  &+ \beta \times 0
  \end{align}
\item Find $\epsilon_{i}$ st $S(\epsilon_{i},z) = 0$.
\item Repeat for all $z$.
\end{itemize}
\end{frame}

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

% \begin{frame}
% \frametitle{Value Function First Iteration}
% \begin{itemize}
% \item (Note: this is not from solving the model)
% \item Value of $S_{t + 1}(\epsilon)$ given $z = z_{1}$ (x-axis is num. of grid pts.):
% \includegraphics[width=0.8\textwidth]{Period1.jpg}
% \item Where is the separation?
% \end{itemize}
% \end{frame}

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

\begin{frame}
\frametitle{Value Function First Iteration}
\begin{itemize}
\item Now, check if problem has converged.
\item What does this mean?
\item The value in the current state is not changing over time.
\item i.e., $S_{t}(\epsilon,z) \approx S_{t + 1}(\epsilon,z)$.
\item First iteration: it won't be.
\item What do we do now?
\item Update the continuation value:
\item $S_{t + 1} = S_{t}$ for all $\epsilon,z$
\item $\theta$ = $q^{-1}(\frac{\kappa}{(1 - \alpha)S})$
\item Solve same problem again.
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Value Function Second Iteration}
\begin{itemize}
\item Solved for $S(\epsilon, Z)$ in previous iteration.
\item Repeat, solving $S\;\forall\epsilon,\;z$
\begin{align*}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x) \nonumber\\&+ (1 - \lambda)max\{S(\epsilon,z'),0\} -A\theta^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x)]\\
  ln(z') &= \rho ln(z) + \epsilon_{z},\;\epsilon_{z}\sim N(0,\sigma_{\epsilon})
\end{align*}
\item Note that the continuation value is {\it\bf not} zero!
  \begin{align}
    e^{z}\epsilon_{1} - b &+ \beta \times \text{Cont. Val}\\
    e^{z}\epsilon_{2} - b &+ \beta \times \text{Cont. Val}\\
    \dots&\\
    e^{z}\epsilon_{N} - b  &+ \beta \times \text{Cont. Val}
  \end{align}
\end{itemize}
\end{frame}

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

% \begin{frame}
% \frametitle{Value Function Second Iteration}
% \begin{itemize}
% \item (Note: this is not from solving the model)
% \item Value of $S_{t + 1}(\epsilon)$ given $z = z_{1}$ (x-axis is num. of grid pts.):
% \includegraphics[width=0.8\textwidth]{Period2.jpg}
% \item Where is the separation?
% \end{itemize}
% \end{frame}

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

\begin{frame}
\frametitle{Value Function Second Iteration}
\begin{itemize}
\item We check again to see if it has converged.
\item is $S_{t}(\epsilon,z) \approx S_{t + 1}(\epsilon,z)$.
\item What do we do now?
\item Update the continuation value:
\item $S_{t + 1} = S_{t}$ for all $\epsilon,z$
\item $\theta$ = $q^{-1}(\frac{\kappa}{(1 - \alpha)S})$
\item Solve same problem again.
\item Keep doing this until the difference is very small.
\end{itemize}
\end{frame}

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

\section{Interpolation} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk

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

\begin{frame}
\frametitle{Great, we're done!}
\includegraphics[width=0.9\textwidth]{ThatWasEasy.jpg}
\begin{itemize}
\item Not so fast: this isn't very accurate.
\item Very slow if we have large numbers of states \& grid points (scales exponentially).
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Fundamental Problem}
\begin{itemize}
\item The reason we need to use a computer to solve this problem is that we {\it don't know} the function $S(\epsilon,z)$.
\begin{align*}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x) \nonumber\\&+ (1 - \lambda)max\{S(\epsilon,z'),0\} -A\theta^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}S(x,z')dF(x)]\\
  ln(z') &= \rho ln(z) + \epsilon_{z},\;\epsilon_{z}\sim N(0,\sigma_{\epsilon})
\end{align*}
\item What is we {\it approximate} $S(\epsilon,z)$ with other functions?
\item Some useful properties we can pick these functions to have:
  \begin{itemize}
  \item Continuous
  \item Differentiable
  \end{itemize}
\item If our approximation is accurate enough, we can drop some grid points!
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Interpolation}
\begin{itemize}
\item Call interpolated function $\hat{V}(k)$. Then,
\begin{align*}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}\hat{S(x,z')}dF(x) \nonumber\\&+ (1 - \lambda)max\{\hat{S(\epsilon,z')},0\} -A\hat{\theta}^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}\hat{S(x,z')}dF(x)]\\
  ln(z') &= \rho ln(z) + \epsilon_{z},\;\epsilon_{z}\sim N(0,\sigma_{\epsilon})
\end{align*}
\item Where $k'$ solves
  \begin{align}
    e^{z}\epsilon - b + \hat{Cont.\;Val} &= 0
  \end{align}
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Updating}
\begin{itemize}
\item We do {\it exactly the same thing as before}:
  \begin{align}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}\hat{S(x,z')}dF(x) \nonumber\\&+ (1 - \lambda)max\{\hat{S(\epsilon,z')},0\} -A\hat{\theta}^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}\hat{S(x,z')}dF(x)]
  \end{align}
\item For each $z$. Then, we check the convergence criteria:
  \begin{align}
    |S_{t} - S_{t + 1}| < errtol
  \end{align}
\item How do we create the function $\hat{S}(\epsilon,z)$?
\item ``Connect the dots'' of $S_{t}(\epsilon,z)$ between all $\epsilon$ levels in order for each $z$.
\item In principle, interpolate in both dimensions, $\epsilon$ and $z$
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Interpolation}
\begin{itemize}
\item Left is function evaluated at sample points $x_{1},...,x_{N}$. Right is for (linearly) interpolated function:
\includegraphics[width=0.45\textwidth]{NotInterpolated.jpg}%
\includegraphics[width=0.45\textwidth]{Interpolated.jpg}
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Interpolation}
\begin{itemize}
\item In constructing our function $\hat{S}(\epsilon,z)$, we need to choose an interpolation scheme.
\item Roughly, what {\it order} function do we believe will be accurate enough to mimick the value function:
  \begin{itemize}
  \item First-order (linear)
  \item Third-order (cubic)
  \item Fifth-order (quintic)
  \end{itemize}
\item Some other useful interpolation routines:
  \begin{itemize}
  \item PCHIP (piecewise cubic hermite interpolating polynomial): shape-preserving (not ``wiggly'') continuous 3rd order spline with continuous first derivative.
  \end{itemize}
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Interpolation}
\begin{itemize}
\item Choice DOES matter:
\end{itemize}
\includegraphics[width=0.9\textwidth]{InterpolationComparison.png}
\end{frame}

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

\begin{frame}
\frametitle{Polynomial Interpolation}
\begin{itemize}
\item Suppose we have a function $y = f(x)$ for which we know the values of $y$ at $\{x_{1},...,x_{n}\}$.
\item Then, the nth-order polynomial approximation to this function $f$ is given by
  \begin{align}
    f(x) \approx P_{n}(x) = a_{n}x^{n} + a_{n - 1}x^{n - 1} + ... + a_{1}x + a_{0}
  \end{align}
\item Then, we have a linear system with $n$ coefficients.
\item We could write this as $y = X\beta$. Look familiar?
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Polynomial Interpolation}
\begin{itemize}
\item We solve
  \begin{align}
    \begin{bmatrix} 1 & x_{0} & x_{0}^{2} & ... & x_{0}^{n}\\
      \vdots & \vdots & \vdots & \vdots & \vdots \\
      1 & x_{n} & x_{n}^{2} & ... & x_{n}^{n}
      \end{bmatrix}\begin{bmatrix} a_{0}\\ \vdots \\ a_{n}\end{bmatrix} =
    \begin{bmatrix} y_{0}\\ \vdots \\ y_{n}
    \end{bmatrix}
  \end{align}
\item For $a_{0},...,a_{n}$
\item What's the example we are all familiar with? Linear regression: $y = \alpha + X\beta$.
\item In practice, this is computationally expensive, but this is the intuition.
\end{itemize}
\end{frame}

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

\section{Uncertainty} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk

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

\begin{frame}
\frametitle{Great, we're done!}
\includegraphics[width=0.9\textwidth]{ThatWasEasy.jpg}
\begin{itemize}
\item Not so fast: how do we handle expected values?
\item Depends on expectation.
\item Need an accurate way to perform numerical integration.
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Surplus function}
\begin{itemize}
\item Problem:
\begin{align*}
        S(\epsilon,z) &= e^{z}\epsilon - b + \beta \alpha E[\lambda\int_{\epsilon_{d}}^{\bar{\epsilon}}\hat{S(x,z')}dF(x) \nonumber\\&+ (1 - \lambda)max\{\hat{S(\epsilon,z')},0\} -A\hat{\theta}^{1 - \eta}\int_{\epsilon_{d}}^{\bar{\epsilon}}\hat{S(x,z')}dF(x)]\\
  ln(z') &= \rho ln(z) + \epsilon_{z},\;\epsilon_{z}\sim N(0,\sigma_{\epsilon})
\end{align*}
\item Make sure your process for $z$ stays non-negative.
\end{itemize}
\end{frame}

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

\begin{frame}
\frametitle{Expectations Generally}
\begin{itemize}
\item Expected values also need to be calculated carefully.
\item Continuation surplus from before:
  \begin{align}
    E[V(\epsilon,z')]
  \end{align}
\item If {\it not} an AR(1)/markov process, need to approximate integral.
\item Generically, pick function $f$ and weights $w_{i}$
  \begin{align}
    E[V(\epsilon,z')] = \int_{a}^{b}f(x)dx \approx \sum_{i = 1}^{N} w_{i}f(x_{i})
  \end{align}
\item $x_{i}$ may be known or picked optimally.
\item We will return to this in the future.
\end{itemize}
\end{frame}

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

\section{Conclusion}

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

\begin{frame}
  \frametitle{Next Time}
  \begin{itemize}
  \item Intro to heterogeneous agents.
  \item Empirical regularities project due soon!
  \end{itemize}
\end{frame}


\end{document}
