Skip to content

Commit

Permalink
Added week 3 material
Browse files Browse the repository at this point in the history
  • Loading branch information
wmutschl committed Apr 26, 2024
1 parent 6c8404c commit fdacc52
Show file tree
Hide file tree
Showing 27 changed files with 738 additions and 413 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/dynare-6.0-matlab-r2024a-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@ jobs:
dynare BaxterKingGrowthSteadyState
cd("../replications/Baxter_King_1993");
dynare Baxter_King_1993_figure_2
dynare Baxter_King_1993_figure_3
- name: Run week 3 codes
uses: matlab-actions/run-command@v2
with:
command: |
addpath("Dynare-6.0-arm64/matlab");
cd("progs/replications/Baxter_King_1993");
dynare Baxter_King_1993_figure_3
cd("../../matlab")
symbolicToolboxIllustation;
matrixAlgebraEigenvalues;
matrixAlgebraKroneckerFormula;
matrixAlgebraCholesky;
matrixAlgebraCompareLyapunovSolvers;
preprocessingComparisonRBC;
18 changes: 16 additions & 2 deletions .github/workflows/dynare-6.0-matlab-r2024a-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
uses: matlab-actions/run-command@v2
with:
command: |
addpath("Dynare-6.0-arm64/matlab");
addpath("dynare/matlab");
cd("progs/matlab");
rbcLogutilSteadyStateTest;
cd("../dynare");
Expand All @@ -92,4 +92,18 @@ jobs:
dynare BaxterKingGrowthSteadyState
cd("../replications/Baxter_King_1993");
dynare Baxter_King_1993_figure_2
dynare Baxter_King_1993_figure_3
- name: Run week 3 codes
uses: matlab-actions/run-command@v2
with:
command: |
addpath("dynare/matlab");
cd("progs/replications/Baxter_King_1993");
dynare Baxter_King_1993_figure_3
cd("../../matlab")
symbolicToolboxIllustation;
matrixAlgebraEigenvalues;
matrixAlgebraKroneckerFormula;
matrixAlgebraCholesky;
matrixAlgebraCompareLyapunovSolvers;
preprocessingComparisonRBC;
18 changes: 16 additions & 2 deletions .github/workflows/dynare-6.0-matlab-r2024a-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
uses: matlab-actions/run-command@v2
with:
command: |
addpath("Dynare-6.0-arm64/matlab");
addpath("D:\hostedtoolcache\windows\dynare-6.0\matlab");
cd("progs/matlab");
rbcLogutilSteadyStateTest;
cd("../dynare");
Expand All @@ -55,4 +55,18 @@ jobs:
dynare BaxterKingGrowthSteadyState
cd("../replications/Baxter_King_1993");
dynare Baxter_King_1993_figure_2
dynare Baxter_King_1993_figure_3
- name: Run week 3 codes
uses: matlab-actions/run-command@v2
with:
command: |
addpath("D:\hostedtoolcache\windows\dynare-6.0\matlab");
cd("progs/replications/Baxter_King_1993");
dynare Baxter_King_1993_figure_3
cd("../../matlab")
symbolicToolboxIllustation;
matrixAlgebraEigenvalues;
matrixAlgebraKroneckerFormula;
matrixAlgebraCholesky;
matrixAlgebraCompareLyapunovSolvers;
preprocessingComparisonRBC;
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,26 @@ Please feel free to use this for teaching or learning purposes; however, taking

</details>

<!---

<details>
<summary>Week 3: Practicing MATLAB, New Keynesian Model</summary>
<summary>Week 3: Practicing DYNARE, Symbolic Preprocessing in MATLAB</summary>

### Goals

* practice DYNARE: permanent changes in fiscal policy
* practice MATLAB: symbolic toolbox, matrix algebra, loops, Kronecker products, functions
* understand and get comfortable with the algebra of New Keynesian models
* practice Dynare with the New Keynesian model
* understand preprocessing and steady-state computations in MATLAB

### To Do

* [x] watch [Algebra of New Keynesian Models with Calvo price rigidities](https://youtu.be/oEf9bc9_qxw) on YouTube
* [x] do the MATLAB exercises 1 and 2 of [week 3's exercise sheet](https://github.com/wmutschl/Computational-Macroeconomics/releases/latest/download/week_3.pdf)
* [x] work carefully and thoroughly through the very long exercise 3 of [week 3's exercise sheet](https://github.com/wmutschl/Computational-Macroeconomics/releases/latest/download/week_3.pdf)
* [x] we will do exercise 4 of [week 3's exercise sheet](https://github.com/wmutschl/Computational-Macroeconomics/releases/latest/download/week_3.pdf) together in class
* [x] finish and re-visit last week's exercises, particularly understand how to add deterministic growth to the RBC model
* [x] do exercises 1, 2 and 3 of [week 3's exercise sheet](https://github.com/wmutschl/Computational-Macroeconomics/releases/latest/download/week_3.pdf)
* [x] we will do exercise 4 of [week 3's exercise sheet](https://github.com/wmutschl/Computational-Macroeconomics/releases/latest/download/week_3.pdf) together in class, but you should already have a look
* [x] bring all your questions and concerns to the Q&A sessions

</details>

<!---
<details>
<summary>Week 4: Preprocessing and steady-state in MATLAB, numerical optimization</summary>
Expand Down
50 changes: 37 additions & 13 deletions exercises/case_study_baxter_king_figure3.tex
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
\section[Case Study Baxter and King (1993, AER): Macroeconomic Effects Of A Four-Year War]{Case Study Baxter and King (1993, AER): Macroeconomic Effects Of A Four-Year War\label{ex:CaseStudy.BaxterKing.Figure3}}

\begin{enumerate}
\item Read the paper by \textcite{Baxter.King_1993_FiscalPolicyGeneral} and focus particularly on the model equations and analysis done in section IV.A.
\item Write a Dynare mod file for the model and calibrate it according to the \emph{Benchmark Model with Basic Government Purchases} given in Table 1.
Compute the steady-state using an \texttt{initval} block.
\item Replicate Figure 3.
\item Do you think this simulation scenario reflects the essence of a war shock?
\item
Read the paper by \textcite{Baxter.King_1993_FiscalPolicyGeneral}
and focus particularly on the model equations and analysis done in section IV.A.

\item
Write a Dynare mod file for the model and calibrate it according to
the \emph{Benchmark Model with Basic Government Purchases} given in Table 1.
Compute the steady-state using an \texttt{initval} block.

\item
Replicate Figure 3.

\item
Do you think this simulation scenario reflects the essence of a war shock?

\end{enumerate}

\paragraph{Notes and hints}

\begin{itemize}
\item According to footnote 3, the quantitative analysis corresponds to a model with labor-augmenting technical progress.
Calibrate $\gamma_X$ such that the economy grows at 1.6\% per annum, a typical value used in e.g.\ \textcite{King.Plosser.Rebelo_1988_ProductionGrowthBusiness}.
\item Pay attention to the different scales on the y-axes, i.e.\ commodity units, percent, and basis points.
\item Skip the term structure variable in panel \emph{C.}, as we will re-visit the term structure in RBC models later on.
\item Use a perfect foresight simulation for computing the transition path
from the initial steady-state (specified by an \texttt{initval} block)
subject to a sequence of four basic government purchases shocks (specified by a \texttt{shocks} block).
\item
According to footnote 3, the quantitative analysis corresponds to a model with labor-augmenting technical progress.
Calibrate \(\gamma_X\) such that the economy grows at 1.6\% per annum,
a typical value used in e.g.\ \textcite{King.Plosser.Rebelo_1988_ProductionGrowthBusiness}.

\item
Pay attention to the different scales on the y-axes,
i.e.\ commodity units, percent, and basis points.

\item
Skip the term structure variable in panel \emph{C.},
as we will re-visit the term structure in RBC models later on.

\item
Use a perfect foresight simulation for computing the transition path
from the initial steady-state (specified by an \texttt{initval} block)
subject to a sequence of four basic government purchases shocks
(specified by a \texttt{shocks} block).

\end{itemize}

\begin{solution}\textbf{Solution to \nameref{ex:CaseStudy.BaxterKing.Figure3}}
\ifDisplaySolutions
\ifDisplaySolutions%
\input{exercises/case_study_baxter_king_figure3_solution.tex}
\fi
\newpage
Expand Down
65 changes: 45 additions & 20 deletions exercises/case_study_baxter_king_figure3_solution.tex
Original file line number Diff line number Diff line change
@@ -1,25 +1,50 @@
\begin{enumerate}
\item[2. and 3.] The mod file might look like this:

\item[2.~and 3.]
The mod file might look like this:
\lstinputlisting[style=Matlab-editor,basicstyle=\mlttfamily\scriptsize,title=\lstname]{progs/replications/Baxter_King_1993/Baxter_King_1993_figure_3.mod}
\item[4.] No, for many reasons. To name just two:

\item[4.]
No, for many reasons. To name just two:

\begin{itemize}
\item A war is a large shock with unknown duration.
Perfect foresight simulations do not capture this as in period 1 everything is revealed to the agents.
A solution to this would be a perfect-foresight simulation with expectation errors (sometimes called MIT-shock).
To this end, one simulates the sequence of shocks but alters the information set of the agents in each period before the onset of another shock.
Algorithmically, we repeat the simulation cycle four times and then combine the simulations,
utilizing the first one for periods $1$ to $2$, the second one for $2$ to $3$, the third one for $3$ to $4$ ..., and the fourth one for $4$ to $T$.
In Dynare 6.0 there is a new command for such a simulation called ``perfect foresight with expectation errors''.
For older versions of Dynare this type of simulation can be done by running a sequence of perfect foresight simulations while adjusting initial conditions manually.
Intuitively, this captures the belief that guides agents during times of war;
namely that the conflict will last only one year (the surprise shock on impact) and will not occur again.
However, this belief is challenged when the war continues beyond the expected duration,
and agents are surprised by the ongoing conflict (restart the simulation with a new surprise shock in the next period).
Despite this surprise, the belief in a one-year duration persists, leading to ongoing cycles of surprise shocks (and expectation errors).
\item A war shock has many channels; solely relying on a demand-side effect via government spending reflects a very US-specific view.
There is some research that war shocks are rather dominated by supply-side effects
and also accompanied by different policy stances during war times.
One could argue that the current simulation is for a neighboring country,
the US being mostly a very distant country to warsites.

\item
A war is a large shock with unknown duration.
Perfect foresight simulations do not capture this as in period 1 everything is revealed to the agents.
A solution to this would be a perfect-foresight simulation with expectation errors (sometimes called MIT-shock).
To this end, one simulates the sequence of shocks
but alters the information set of the agents in each period
before the onset of another shock.
Algorithmically, we repeat the simulation cycle four times
and then combine the simulations,
utilizing the first one for periods \(1\) to \(2\),
the second one for \(2\) to \(3\), the third one for \(3\) to \(4\) \ldots,
and the fourth one for \(4\) to \(T\).
In Dynare 6.0 there is a new command for such a simulation called
\texttt{perfect{\_}foresight{\_}with{\_}expectation{\_}errors}.
For older versions of Dynare this type of simulation can be done
by running a sequence of perfect foresight simulations
while adjusting initial conditions manually.
Intuitively, this captures the belief that guides agents during times of war;
namely, that the conflict will last only one year
(the surprise shock on impact) and will not occur again.
However, this belief is challenged when the war continues beyond the expected duration,
and agents are surprised by the ongoing conflict
(restart the simulation with a new surprise shock in the next period).
Despite this surprise, the belief in a one-year duration persists,
leading to ongoing cycles of surprise shocks (and expectation errors).

\item
A war shock has many channels;
solely relying on a demand-side effect via government spending
reflects a very US-specific view.
There is research that war shocks are rather dominated by supply-side effects
and also accompanied by different policy stances during war times.
One could argue that the current simulation is for a neighboring country,
as the US has never really been a war site itself
(except for comparably minor battles of Pearl Harbor and the Aleutian islands
during World War II).
\end{itemize}

\end{enumerate}
Loading

0 comments on commit fdacc52

Please sign in to comment.