%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beamer Presentation
% LaTeX Template
% Version 1.0 (10/11/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

\documentclass[hyperref={colorlinks=true}]{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{amssymb}
% \usepackage{showframe}
\usepackage{caption}

%\usepackage{subcaption}
\usepackage{tcolorbox}
\usepackage{tikz}
\usepackage{tabularx}
\usepackage{array}
\usepackage{pgfplots}
\tcbuselibrary{skins}


\usepackage{subfig}
\beamertemplatenavigationsymbolsempty
\usepackage{color, colortbl}
\definecolor{LRed}{rgb}{1,.8,.8}
\definecolor{MRed}{rgb}{1,.6,.6}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.multipart,fit,shapes.misc,positioning}
\newcommand{\der}[2]{\frac{\partial #1}{\partial #2}}
%\usepackage[labelformat=empty]{caption}

\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}

\newcommand\marktopleft[1]{%
    \tikz[overlay,remember picture]
        \node (marker-#1-a) at (0,1.5ex) {};%
}
\newcommand\markbottomright[1]{%
    \tikz[overlay,remember picture]
        \node (marker-#1-b) at (7ex,0) {};%
    \tikz[overlay,remember picture,thick,dashed,inner sep=3pt]
        \node[draw=black,rounded corners=0pt,fill=red,opacity=.2,fit=(marker-#1-a.center) (marker-#1-b.center)] {};%
}


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

\title[]{Macro II} % 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{Spring 2025} % 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{Introduction}
  \begin{itemize}
  \item Today: Solution techniques I
  \item Some solution techniques:
    \begin{itemize}
    \item Value function iteration (you've basically done this);
    \item guess and verify (method of undetermined coefficients).
    \end{itemize}
  \item Exam 3/27
  \item Homework 3 is due this Thursday
  \item Homework 4 is due Tuesday, 3/25
  \end{itemize}
\end{frame}

% ------------------------------------------------
\section{Solution Methods}

\begin{frame}{Solution Methods: Introduction}
\begin{itemize}
\setlength\itemsep{1.5em}
\item Today we will explore solutions to the Neoclassical Growth model.
\item The first two directly solve the problem at hand:
  \begin{enumerate}
  \item guess and verify: guess the functional form for the value/policy function
  \item (by hand) value function iteration: iterate on value function until you see a pattern.
  \end{enumerate}
% \item The last ``method'' (\textbf{functional EE}) is actually a tool that is useful for finding the EE / allocations / steady state values \\
\item First: recall definition of recursive competitive equilibrium.
\end{itemize}
\end{frame}

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

\begin{frame}{Recursive Competitive Equilibrium}
\textbf{Definition.} Let $K$ denote the state of the aggregate economy and $a$ denote the personal state of an agent. Then a \emph{Recursive Competitive Equilibrium (RCE)} is a set of functions that describe \\ \vspace{1em}
\indent Quantities: $K' = G(K)$, $a' = g(a,K)$ \hfill{\textcolor{blue}{(agg. and ind. policy fns)}} \\
\indent Lifetime Utility: $V(a,K)$ \hfill{\textcolor{blue}{(the value function)}} \\
\indent Prices: $r(K) = f_K(K,N)+1-\delta$, $w(K) = f_N(K,N)$ \hfill{\textcolor{blue}{(competitive prices)}} \\ \vspace{1em}
such that: \\ \vspace{.7em}
\begin{enumerate}
\setlength\itemsep{.5em}
\item Prices are complete and given
\item $V(a,K)$ and $g(a,K)$ solve the consumer's problem
\item Consistency: $G(K) = g(K,K)$ \\ \vspace{.7em}
\end{enumerate}
\textcolor{blue}{
That is, households must know prices so they can make utility maximizing decisions and if we gave on person all of the capital, their choice would coincide with the aggregation of choices.
}
\end{frame}

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

\section{Guess and Verify}

\begin{frame}{Guess and Verify}
\begin{itemize}
\setlength\itemsep{1.5em}
\item This method is also known as the \emph{Method of Undetermined Coefficients}

\item It involves \emph{guessing} the form of the value/policy function, and then \emph{verifying} that the guess is consistent with the optimization problem
\item The idea is that, if the guess is correct, then when ``operated on'' it should recover that same form and we can back-out the coefficients previously left \emph{undetermined}
	\begin{itemize}
		\item Recall our solution is a fixed point: $Tv^* = v^*$
	\end{itemize}

\item This solution technique has several requirements:
	\begin{itemize}
		\item{Unique Solution}
		\item{``Correct Guess"}
\end{itemize}
\end{itemize}
\end{frame}

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

\begin{frame}{Guessing the Policy Function}
\frametitle{Guess and Verify: Policy Function}
Neoclassical growth model. Households solve the following:
\begin{gather*}
U=\max\limits_{\{c_t\}_{t=0}^\infty}\:\:\textstyle\sum\limits_{t=0}^\infty \beta^t\:\ln(c_t)\qquad s.t.\qquad c_t+k_{t+1}=k_t^\alpha
\end{gather*}\vfill

The recursive problem is given by the following
\begin{gather*}
V(k)=\max\limits_{k'}\{\ln(k^\alpha-k')+\beta V(k')\}
\end{gather*}\vfill
Steps:
\begin{enumerate}
\item Guess that $k'=\eta k^\alpha$.
\item Solve for the undetermined coefficient, $\eta$, and
\item find the policy function for capital and consumption
\end{enumerate}
\end{frame}

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

\begin{frame}\frametitle{Policy G \& V}
First take the F.O.C. of the optimization problem. \\
\begin{align*}
\frac{1}{k^{\alpha}-k'} = \beta \frac{d V(k')}{dk'} \\
\end{align*}
Note that there is a $k'$ on the LHS. \\
Optimal policy fn must satisfy the F.O.C $\rightarrow$ we plug in our guess. \\
\begin{align*}
\frac{1}{k^{\alpha}-(\eta k^{\alpha})} = \beta \frac{d V(k')}{dk'} \qquad \Longrightarrow \qquad \frac{1}{(1-\eta)k^{\alpha}} = \beta \frac{d V(k')}{dk'} \\
\end{align*}
Envelope theorem for $dV(k')/dk'$: \\
\begin{align*}
\frac{dV(k)}{dk} = \frac{1}{k^{\alpha} - k'}(\alpha k^{\alpha-1}) = \underbrace{\frac{1}{(1-\eta)k^{\alpha}}(\alpha k^{\alpha-1})}_{\text{plug in the guess}} = \frac{\alpha}{(1-\eta)k} \\
\end{align*}
\end{frame}

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

\begin{frame}\frametitle{Policy G \& V II}
``Pushing forward,'' we have \\
\begin{align*}
\frac{dV(k')}{dk'} = \frac{\alpha}{(1-\eta)k'} = \underbrace{\frac{\alpha}{(1-\eta) \eta k^{\alpha}}}_{\text{plug in the guess}}. \\
\end{align*}
Plug into the F.O.C. $\rightarrow$ can now solve for undetermined coeff. $\eta$. \\
\begin{align*}
\frac{1}{(1-\eta)k^{\alpha}} = \frac{\alpha \beta}{(1-\eta) \eta k^{\alpha}} \qquad \Longrightarrow \qquad \eta = \alpha \beta, \\
\end{align*}
which we can verify is a constant. Policy fns:
\begin{align*}
k' = \alpha \beta k^{\alpha} \qquad \text{and} \qquad c = (1-\alpha \beta) k^{\alpha}.
\end{align*}
\end{frame}

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

\begin{frame}
\frametitle{Guess and Verify: Value Function}
Now let's try our hand at guessing the value function for the same problem: \\
\begin{align*}
V(k) = \max\limits_{k'} \left\{ ln(k^{\alpha}-k') + \beta V(k') \right\}. \\
\end{align*}
\begin{enumerate}
\item Guess that $V(k) = A + Bln(k)$, where $A$ and $B$ are the undetermined coefficients.
\item Note: guess should always mirror utility function + constant.
\end{enumerate}
\end{frame}

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

\begin{frame}\frametitle{G \& V II}
First solve the RHS maximization problem, with guess for $V(k')$. \\
\begin{align*}
& \frac{d RHS}{dk'} = \frac{d}{dk'} \left\{ ln(k^{\alpha}-k') + \beta \left[ A + Bln(k') \right] \right\} = 0 \\\\
& \Longrightarrow \qquad k' = \frac{\beta B k^{\alpha}}{1+\beta B} \\
\end{align*}
Now, to evaluate the RHS at the optimum we plug in $k'$. \\
\begin{align*}
RHS\left(k'^{*}\right) & = ln \left( k^{\alpha} - \frac{\beta B k^{\alpha}}{1+\beta B} \right) + \beta \left[ A + Bln\left( \frac{\beta B k^{\alpha}}{1+\beta B} \right) \right] \\\\
& = ln \left( \frac{k^{\alpha}}{1+\beta B} \right) + \beta A + \beta B ln\left( \frac{\beta B k^{\alpha}}{1+\beta B} \right)
\end{align*}
\end{frame}

\begin{frame}\frametitle{Verifying}
Now, group the constants together and the $k$ terms separately. \\
\begin{align*}
RHS\left(k'^{*}\right) &= \underbrace{-ln(1+\beta B) + \beta A + \beta B ln \left( \frac{\beta B}{1+\beta B} \right)}_{\text{constant}} \\&+ \underbrace{\alpha (1+\beta B)}_{\text{$ln(k)$-term coeff.}} ln(k) \\
\end{align*}
The $V$ on the LHS should also have the form of our guess:
\begin{align*}
A & = \text{constant} = -ln(1+\beta B) + \beta A + \beta B ln \left( \frac{\beta B}{1+\beta B} \right) \\\\
B & = \text{$ln(k)$-term coeff.} = \alpha (1+\beta B) \\
\end{align*}
Because it can be written as $V(k) = A + B ln(k)$, guess is verified.
\end{frame}

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

\begin{frame}\frametitle{G \& V III}
Now solve for $B$ using the second equation, and then $A$ from the first. \\
\begin{align*}
B = \frac{\alpha}{1-\alpha \beta} \qquad \text{and} \qquad  A = \frac{1}{1-\beta} \left[ ln(1-\alpha \beta) + \frac{\alpha \beta}{1-\alpha \beta} ln(\alpha \beta) \right] \\
\end{align*}
We might also want to get the policy function. Recall that we actually solved for it earlier. All we need to do is plug in for $B$. \\
\begin{align*}
k' & = \frac{\beta B k^{\alpha}}{1+\beta B} \qquad \Longrightarrow \qquad k' = \alpha \beta k^{\alpha}
\end{align*}
\end{frame}

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

\section{Value function iteration}

\begin{frame}\frametitle{Value Function Iteration}
\begin{itemize}
\setlength\itemsep{2em}
\item This method relies on the ideas of a contraction / fixed point
\item Recall: (\emph{paraphrasing}) ''starting from any possible $V_0$ in the space of potential solutions, when iterating on $V_0$ we will get closer and closer to the true $V$''
\item We are going to make an initial guess at $V$ (generally $V_0 = 0$), and then iterate.
\item Look for a pattern.
\end{itemize}
\end{frame}

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

\begin{frame}\frametitle{Value Function Iteration}
\begin{itemize}
\setlength\itemsep{2em}
\item The above is true if we are assuming an infinite horizon; what if there is some terminal period $T$ (for example, a lifecycle model)?
\item Then you can think of this process like you would backwards induction\dots \\
\begin{itemize}
\setlength\itemsep{.7em}
\item $V_0$ is the value at $T+1$ ($=0$)
\item $V_1$ is the value you get in $T$ when optimizing knowing that $V_0 = 0$
\item etc.
\end{itemize}
\item You would continue this process until you found the value function for the first date through the last date: $V_{T},\dots,V_1,V_0$, and your answer would effectively be the sequence of value (or policy) functions
\end{itemize}
\end{frame}

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

\begin{frame}\frametitle{First Iteration}
Let's try our hand at an easy example; consider the problem we've been working with and initialize the iterations with $V_0(k') = 0$
\begin{align*}
V_1(k) = \max\limits_{k'} \big\{ ln(k^{\alpha}-k') + \beta \underbrace{0}_{V_0(k')} \big\}
\end{align*}
Optimization requires that $k'=g_1(k) = 0$ (calculus doesn't work here, we are at a ``corner''). Knowing this, we can plug in this optimal policy to find $V_1(k)$. \\
\begin{align*}
V_1(k) = ln(k^{\alpha}-0) = \alpha ln(k) \\
\end{align*}
Now for a second round \dots
\end{frame}

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

\begin{frame}[shrink=10]\frametitle{Second Iteration}
\begin{align*}
V_2(k) = \max\limits_{k'} \big\{ ln(k^{\alpha}-k') + \beta \underbrace{\alpha ln(k')}_{V_1(k')} \big\}
\end{align*}
Let's optimize. \\
\begin{align*}
\frac{dV_2(k)}{dk'} = 0 \qquad \Longrightarrow \qquad k' = g_2(k) = \frac{\alpha \beta}{1+\alpha \beta} k^{\alpha} \\
\end{align*}
Knowing this, we can plug in this optimal policy to find $V_2(k)$. \\
\begin{align*}
V_2(k) & = ln \left( \frac{ k^{\alpha}}{1+\alpha \beta} \right) + \alpha \beta ln \left( \frac{\alpha \beta}{1+\alpha \beta} k^{\alpha} \right) \\\\
& = ln \left( \frac{1}{1+\alpha \beta} \right) + \alpha \beta ln\left( \frac{\alpha \beta}{1+\alpha \beta} \right) + \alpha (1+\alpha \beta) ln(k) \\
\end{align*}
Let's go for a third, round, paying attention to an emerging pattern.
\end{frame}

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

\begin{frame}[shrink=10]\frametitle{Third Iteration}
\begin{align*}
V_3(k) &= \max\limits_{k'} \big\{ ln(k^{\alpha}-k') \\&+ \beta \underbrace{\Big[ln \left( \frac{1}{1+\alpha \beta} \right) + \alpha \beta ln\left( \frac{\alpha \beta}{1+\alpha \beta} \right) + \alpha (1+\alpha \beta) ln(k') \Big]}_{V_2(k')} \big\}
\end{align*}
Optimize. \\
\begin{align*}
\frac{dV_3(k)}{dk'} = 0 \qquad \Longrightarrow \qquad k' = g_3(k) = \frac{\alpha \beta + (\alpha \beta)^2}{1+ \alpha \beta + (\alpha \beta)^2} k^{\alpha} \\
\end{align*}
Plug the optimal policy back in to find $V_3(k)$. \\
\begin{align*}
V_3(k) = \beta ln \left( \frac{1}{1+\alpha \beta} \right) + \alpha \beta^2 ln \left( \frac{\alpha \beta}{1+\alpha \beta} \right) + (\alpha \beta + (\alpha \beta)^2) ln \left( \frac{\alpha \beta + (\alpha \beta)^2}{1 + \alpha \beta + (\alpha \beta)^2} \right) \\\\
+ \alpha (1+\alpha \beta + (\alpha \beta)^2) ln(k)
\end{align*}
\end{frame}

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

\begin{frame}\frametitle{Pattern}
We could continue (or make our computer do it), but for this problem we can see a pattern emerge. We can see that as we let the iteration $s \rightarrow \infty$, we'll have \\
\begin{align*}
g^*(k) = \lim\limits_{s \rightarrow \infty} g_s(k) = \alpha \beta k^{\alpha}. \\
\end{align*}
See guess earlier for how to ``derive'' the above. The Value function itself can be shown to converge to \\
\begin{align*}
V^*(k) &= \lim\limits_{s \rightarrow \infty} V_s(k) = \frac{1}{1-\beta} \left[ ln(1-\alpha \beta) + \frac{\alpha \beta}{1-\alpha \beta} ln(\alpha \beta) \right] \\&+ \frac{\alpha}{1-\alpha \beta}ln(k), \\
\end{align*}
which is what we found earlier with \emph{Guess and Verify}.
\end{frame}

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

\section{Functional EE}

\begin{frame}\frametitle{Functional Euler Equation}
\begin{itemize}
\setlength\itemsep{1.5em}
\item This last ``method'' doesn't actually solve for the value / policy functions directly (though you can back them out)
\item Sometimes you might see this called the Euler-Lagrange Equation
\item It involves the construction of a ``Lagrangian'' using the Bellman Operator; here, though, we are mapping functions to functions (hence ``functional equation'')
\item The procedure should feel very familiar to you, as you've sort of seen it in previous sections; set up the ``Lagrangian'' and take F.O.C.s, find the EE and use constraints / conditions (e.g. market clearing) to solve for whatever you desire
\end{itemize}
\end{frame}

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

\begin{frame}\frametitle{Functional Euler Equation}
Just to get an idea, let's try it out on our running example: \\
\begin{align*}
& \mathcal{L} = ln(c) + \beta V(k') + \lambda \big[k^{\alpha} - c - k' \big] \\\\
& \qquad \frac{\partial \mathcal{L}}{\partial c} = 0: \qquad \lambda = \frac{1}{c} \tag{1} \\
& \qquad \frac{\partial \mathcal{L}}{\partial k'} = 0: \qquad \lambda = \beta \frac{dV(k')}{dk'} \tag{2} \\
& \qquad \frac{\partial \mathcal{L}}{\partial \lambda} = 0: \qquad c + k' = k^{\alpha} \tag{3} \\
\end{align*}
Combine (1) and (2). \\
\begin{align*}
\frac{1}{c} = \beta \frac{dV(k')}{dk'} \tag{4}
\end{align*}
\end{frame}

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

\begin{frame}\frametitle{Functional Euler Equation}
Now let's use the envelope theorem. Evaluating $\mathcal{L}$ at the same value as $V$ on the RHS, the two are equal. Further we know that $V \leq \mathcal{L}$. Thus \\
\begin{align*}
\frac{\partial \mathcal L}{\partial k} = \frac{dV(k)}{dk} \qquad \Longrightarrow \qquad \frac{dV(k)}{dk} = \lambda [ \alpha k^{\alpha-1} ] \\
\end{align*}
Pusing this forward, and plugging in for $\lambda ' = 1/c'$\dots \\
\begin{align*}
\frac{dV(k')}{dk'} = \frac{1}{c'} [ \alpha k'^{\alpha-1} ], \tag{5} \\
\end{align*}
noting that $\alpha k^{\alpha-1} = 1+r$ when $\delta = 1$ (which is what we have in this example).
\begin{align*}
\rightarrow \frac{1}{c} = \beta [ \alpha k'^{\alpha-1} ] \frac{1}{c'} \tag{EE}
\end{align*}
\end{frame}

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

\begin{frame}\frametitle{Functional Euler Equation}
\begin{itemize}
\setlength\itemsep{1.5em}
\item From here we can do many things\dots
\item You might want to find steady state values: plug in to budget constraints / market clearing conditions, do comparative statics, etc.
\item Alternatively, you may want to recover the policy function: one way would be to iterate on the EE like we did in section 2 (you would find $k' = \alpha \beta k^{\alpha}$)
\item This technique may seem more roundabout than last time (recall I just plugged the constraint right into the objective), but just note that this method is slightly more general insofar as it handles situations where you can't easily substitute in all constraints
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Conclusion}
  \begin{itemize}
  \item Next time: Lecture 13 (RBC Model).
  \item Midterm in just over 2 weeks (3/27)
  \item Homework 4 will also be due that week (3/25, will be helpful)
  \end{itemize}
\end{frame}


\end{document}
