%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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{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 2022} % 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{Course 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{Welcome to Macro II}
  \begin{itemize}
  \item My name: Ben Griffy.
  \item Email: bgriffy@albany.edu.
  \item Office Hours: TTh 10:30-11:30am in-person (for now).
  \item Teaching Assistant:
    \begin{itemize}
    \item George Siton
  \item Email: gsiton@albany.edu
  \item Office Hours WTh 1-3:00pm online.
  \end{itemize}
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Course Overview}
  \begin{itemize}
  \item What is this course about?
    \begin{enumerate}
    \item Learning about key questions addressed by macroeconomists.
    \item Developing advanced tools to address those questions.
    \item Seeing how others have worked to address those questions.
    \end{enumerate}
  \item I will emphasize quantitative (computational) work.
  \item I see this as a complement to Adrian's more analytical course.
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Course Requirements}
  \begin{itemize}
  \item Materials:
    \begin{enumerate}
    \item We will mostly rely on Ljundqvist and Sargent.
    \item Feel free to get an older version (problems might differ between versions).
    \item There are some suggested textbooks as well as free resources in the syllabus.
    \end{enumerate}
  \item Tools:
    \begin{enumerate}
    \item One (or two, or three, or ...) programming language.
    \item My suggestion: Matlab, Julia, (Fortran or C++, or maybe Python) for dynamic programming/numerical optimization.
    \item Python and Julia are free and we have a campus Matlab license.
    \item We probably won't do any data analysis, so don't worry about R/Stata.
    \item \LaTeX for homework and projects.
    \end{enumerate}
  \item Please note: best resource for class materials is my website: https://www.bengriffy.com
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Grading}
  \begin{itemize}
  \item Semi-weekly homework: 30\%. I will (intend to) give you a homework assignment at least every other week.
  \item I am going to require that the homework be turned in through the campus cluster.
  \item Midterm (30\%):
  \item Final (40\%):
  \item My philosophical view of first-year grades: the comps are your real ``grade'' in the course, so I am unlikely to fail anyone.
  \item I just want to see that you understand the material and are putting in the effort required to pass comps.
  \end{itemize}
\end{frame}

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

% \begin{frame}
%   \frametitle{Scheduling}
%   \begin{itemize}
%   \item I may be out of town a few different times during the quarter.
%   \item I know for sure that I will miss at least one class the week of April 8th.
%   \end{itemize}
% \end{frame}

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

\section{Empirical Regularities} % 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{What do Macroeconomists Study?}
  \begin{itemize}
  \item Macroeconomics:
    \begin{itemize}
    \item what are the aggregate consequences of individual decisions for
      \begin{enumerate}
      \item growth;
      \item business cycles.
      \end{enumerate}
    \end{itemize}
  \item this is not exhaustive: labor markets, finacial markets, international trade, etc.
  \item To do this, we specify models with
    \begin{enumerate}
    \item individuals and firms with assumptions about preferences and technology;
    \item an equilibrium that describes how individual actions will aggregate.
    \end{enumerate}
  \item In this course, we will focus on using models to understand business cycles.
  \item Today: start by exploring the data.
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{What is a business cycle?}
\centering\includegraphics[width=0.8\textwidth]{BusinessCycleDef.png}
\begin{itemize}
\item What do you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Empirical Regularities (aka Stylized Facts)}
  \begin{itemize}
  \item To guide our models, we look at ``empirical regularities'' or ``stylized facts.''
  \item These are patterns we observe in the data that
    \begin{enumerate}
    \item motivate the construction of our models and/or
    \item that we seek to understand.
    \end{enumerate}
  \item For example, Kydland and Prescott (1982): ``The equilibrium growth model is modified and used to explain the
    \begin{enumerate}
    \item cyclical variances of a set of economic time series,
    \item the covariances between real output and the other series,
    \item and the autocovariance of output.''
    \end{enumerate}
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Empirical Regularities and Business Cycles}
  \begin{itemize}
  \item Business cycles are not identical, but do have commonality.
  \item We want our models to capture what is common
  \item then perhaps use them to explain what differs.
  \item Cyclicality: when GDP goes up, does a variable move \textbf{up} (procyclical) or \textbf{down} (countercyclical)?
  \item Some procyclical variables:
    \begin{itemize}
    \item production, consumption, investment, and employment.
    \item inflation, real wages, and money growth.
    \end{itemize}
  \item First group generally a function of GDP, should always move with GDP.
  \item Second group, predictions less clear.
  \item A macro model might seek to explain the movement of this second group.
  \item Let's look at the time series.
  \end{itemize}
\end{frame}

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


\begin{frame}
  \frametitle{GDP Growth 1960-2015}
\centering\includegraphics[width=0.8\textwidth]{GDPChange1.png}
\begin{itemize}
\item What are some patterns you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{GDP and Components Volatility}
\centering\includegraphics[width=0.8\textwidth]{GDPVolatility.png}
\begin{itemize}
\item How does volatility between these series compare?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Cyclicality Summary}
\centering\includegraphics[width=0.7\textwidth]{CyclicalityTable.png}
\begin{itemize}
\item Want our business cycle models to be consistent with all of these regularities.
\item Often unrealistic, depends on question.
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{More NIPA Components}
\centering\includegraphics[width=0.8\textwidth]{ConsumptionInvestmentTimeSeries.png}
\begin{itemize}
\item What do you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Labor Markets}
  \begin{itemize}
  \item In addition to NIPA components (cons., inv., gov't spend, net exports), labor markets important.
  \item Unemployment: consistent feature of recessions.
  \item More labor market indicators:
    \begin{itemize}
    \item Job-Finding Rate: probability that someone searching (generally unemployed) for a job finds one.
    \item Job Separation Rate: probability that someone currently employed loses their job.
    \end{itemize}
  \item Nuance: unemployment and employment are stocks;
  \item job-find and job sep. are flows.
  \item To understand fluctuations in unemployment rate, we need to understand fluctuations in flows!
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Employment}
\centering\includegraphics[width=0.8\textwidth]{EmploymentTimeSeries.png}
\begin{itemize}
\item What is important to note about this figure? (hint: look left)
\item Why does the denominator matter?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Unemployment}
\centering\includegraphics[width=0.8\textwidth]{UnemploymentTimeSeries.png}
\begin{itemize}
\item What do you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Job Finding Rate}
\centering\includegraphics[width=0.8\textwidth]{JobFindingRateTimeSeries.png}
\begin{itemize}
\item How does this coincide with what we saw for unemployment?
\item Does this contribute to the cyclicality of unemployment?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Job Sepration Rate}
\centering\includegraphics[width=0.8\textwidth]{SeparationRateTimeSeries.png}
\begin{itemize}
\item How does this coincide with what we saw for unemployment?
\item What would you say is driving unemployment?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Productivity vs. Real Wage}
\centering\includegraphics[width=0.8\textwidth]{RealWageProductivityTimeSeries.png}
\begin{itemize}
\item What do you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Questions}
  \begin{itemize}
  \item Perfect competition: real wage = marginal productivity.
  \item Marginal productivity hard to measure $\approx$ average productivity.
  \item Do they move together over the business cycle?
  \item What could this mean?
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Money Growth and Inflation}
\centering\includegraphics[width=0.8\textwidth]{MoneyGrowth.png}
\begin{itemize}
\item What do you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Nominal Interest Rates}
\centering\includegraphics[width=0.8\textwidth]{NominalInterestRates.png}
\begin{itemize}
\item How does this differ?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Some equations}
  \begin{itemize}
  \item Velocity equation:
    \begin{align}
      \%\Delta M + \%\Delta V  = \%\Delta P + \%\Delta Y
    \end{align}
  \item What's going on?
  \item Fisher Equation:
    \begin{align}
      i \approx r + \pi
    \end{align}
  \item What does this mean for the real interest rate?
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Industrial Production across Countries}
\centering\includegraphics[width=0.8\textwidth]{IndustrialProduction.png}
\begin{itemize}
\item What changes do you notice?
\end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Empirical Regularities}
  \begin{itemize}
  \item These are just some things that we observe in the data.
  \item I should emphasize that macro
    \begin{itemize}
    \item is more broad than just business cycles or growth
    \end{itemize}
  \item Macroeconomists study inequality, labor markets, technology, money, wealth, assets, etc.
  \item Business cycles are a convenient jumping off point.
  \end{itemize}
\end{frame}

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

\section{Other Preliminaries} % 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{Programming Basics}
  \begin{itemize}
  \item Modern macro: most models not solvable by hand:\\
"The era of closed-form solutions for their own sake should be over. Newer generations get similar intuitions from computer-generated examples than from functional expressions," \\  -Jose-Victor Rios-Rull (JME, 2008).
  \item But we're rarely taught anything about programming.
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Matlab}
  \begin{itemize}
  \item Focus on Matlab (because it's most widely used), but should apply for nearly any language.
  \item Variables:
    \begin{itemize}
    \item store numbers, vectors (1 x n or n x 1), arrays or matrices (m x n)
    \item can perform operations on these variables (addition, subtraction, multiplication)
    \end{itemize}
  \item Functions:
    \begin{itemize}
    \item take variables as inputs
    \item return something useful
    \end{itemize}
  \item Indexing:
    \begin{itemize}
    \item way to access a specific column or row.
    \item i.e., say we have a variable X. X(1,2) accesses row 1, column 2 (x and y are flipped for indexing).
    \item X(:,2) accesses all rows of column 2.
    \end{itemize}
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Simple Example: Regression}
\centering\includegraphics[width=0.45\textwidth]{RegMatrices.png}
  \begin{itemize}
  \item Specified X and y matrices in Matlab. Now regress:
    \end{itemize}
\centering\includegraphics[width=0.5\textwidth]{RegOutput.png}
  \begin{itemize}
  \item i.e., intercept is 10 and coefficients are 2 and -2.
    \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Where programming gets tricky}
  \begin{itemize}
  \item When we're working by hand, we solve for a functional expression, $y = f(x)$.
  \item Generally cannot do this for dynamic programming.
  \item Instead, approximate function $y_{i}\approx \hat{f}(x_{i})$.
  \item i.e., find a function $\hat{f}(x)$ that approximates $f(x)$ and evaluate it at a pre-specified set of points, $x_{i}, i=1,...,N$.
  \item An example: what is $f(k) = k^{\alpha}$ for $k = 1,...,10$?
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Production function}
    \begin{figure}[ht]
        \begin{minipage}[b]{0.4\linewidth}
            \centering
            \includegraphics[width=0.4\textwidth]{aalpha.png}
            \caption{$\alpha$ parameter}
            \label{fig:a}
        \end{minipage}
        \hspace{0.5cm}
        \begin{minipage}[b]{0.5\linewidth}
            \centering
            \includegraphics[width=\textwidth]{kGrid.png}
            \caption{Grid of $k$ values}
            \label{fig:b}
        \end{minipage}
    \end{figure}

  \begin{itemize}
  \item Need $\alpha$, grid of $k$ values, and function.
    \end{itemize}
    \begin{figure}[ht]
        \begin{minipage}[b]{0.4\linewidth}
            \centering
            \includegraphics[width=0.6\textwidth]{prodFun.png}
            \caption{Prod. function $k^{\alpha}$}
            \label{fig:a}
        \end{minipage}
        \hspace{0.5cm}
        \begin{minipage}[b]{0.525\linewidth}
            \centering
            \includegraphics[width=1.15\textwidth]{prodGrid.png}
            \caption{Output at $k$ grid}
            \label{fig:b}
        \end{minipage}
    \end{figure}

  \begin{itemize}
  \item Note: specified prod function for x, not k.
  \item Important: already specified k as grid.
    \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Last example}
  \begin{itemize}
  \item That wasn't so bad. But what about a more dynamic problem?
  \item Consider this problem:
  \item An agent needs to split consumption over the life-cycle (2 periods).
    \begin{align}
      &\max_{a} u(c_{1}) + \beta u(c_{2})\\
      \text{s.t. }\;& c_{1} + a \leq m\\
           &c_{2} \leq (1 + r)a
    \end{align}
  \item We can solve this by hand for any value of $m$.
  \item How would we solve on computer for any $m$? We need
    \begin{itemize}
    \item $u(x)$, $\beta$, $r$
    \item $m$ grid, $a$ grid.
    \end{itemize}
  \item What we will do: set up a $c_{1}$ and $c_{2}$ grid.
  \item These depend on values of $m$ and decisions of $a$.
  \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Preliminaries}
    \begin{figure}[ht]
        \begin{minipage}[b]{0.4\linewidth}
            \centering
            \includegraphics[width=0.4\textwidth]{rVal.png}
            \caption{$r$ parameter}
            \label{fig:a}
        \end{minipage}
        \hspace{0.5cm}
        \begin{minipage}[b]{0.5\linewidth}
            \centering
            \includegraphics[width=\textwidth]{bbetaVal.png}
            \caption{$\beta$ value}
            \label{fig:b}
        \end{minipage}
    \end{figure}

  \begin{itemize}
  \item Need $\alpha$, grid of $k$ values, and function.
    \end{itemize}
    \begin{figure}[ht]
        \begin{minipage}[b]{0.4\linewidth}
            \centering
            \includegraphics[width=1.15\textwidth]{mGrid.png}
            \caption{$m$ grid}
            \label{fig:a}
        \end{minipage}
        \hspace{0.5cm}
        \begin{minipage}[b]{0.525\linewidth}
            \centering
            \includegraphics[width=1.15\textwidth]{aGrid.png}
            \caption{Output at $a$ grid}
            \label{fig:b}
        \end{minipage}
    \end{figure}

  \begin{itemize}
  \item Note: specified prod function for x, not k.
  \item Important: already specified k as grid.
    \end{itemize}
\end{frame}

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

\begin{frame}
  \frametitle{Consumption Grids}
  \centering\includegraphics[width=0.8\textwidth]{c1Grid.png}
  \begin{itemize}
  \item m is in rows, 1 to 10. a choice in columns, 1 to 10.
  \end{itemize}
  \centering\includegraphics[width=0.8\textwidth]{c2Grid.png}
  \begin{itemize}
  \item Make matrices conformable, i.e., size of c1Grid
  \end{itemize}
\end{frame}



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

\begin{frame}
  \frametitle{Value Function}
  \includegraphics[width=1.09\textwidth]{ValFun1.png}
  \begin{itemize}
  \item lifetime val  $= u(c1Grid) + \beta\times u(c2Grid)$
  \end{itemize}
  \centering\includegraphics[width=0.8\textwidth]{ValFun2.png}
  \begin{itemize}
  \item Can't eat less than nothing
  \end{itemize}
\end{frame}



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

\begin{frame}
  \frametitle{Maximize}
  \centering\includegraphics[width=1.09\textwidth]{ValFun2.png}
  \begin{itemize}
  \item Now, best savings decisions for each level of money?
  \end{itemize}
  \centering\includegraphics[width=0.4\textwidth]{Max1.png}
  \centering\includegraphics[width=\textwidth]{Max4.png}
  \begin{itemize}
  \item We picked the best decision for each initial value!
  \end{itemize}
\end{frame}



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

\section{Conclusion}
% ------------------------------------------------


\begin{frame}
  \frametitle{Next Time}
  \begin{itemize}
  \item In class: Outline models in modern macro.
  \item You guys:
    \begin{itemize}
    \item Install the appropriate programming languages.
    \item Look at my handout (online) about accessing the cluster.
    \item Solve 2-period model by hand, then solve on computer for $u(c) = \frac{c^{1 -  \sigma}}{1 - \sigma}$ where $\sigma = 2$.
    \end{itemize}
  \item Due next Thursday (2/3).
  \end{itemize}
\end{frame}


\end{document}
