Skip to content

Commit

Permalink
Added week 7 exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
wmutschl committed Nov 29, 2024
1 parent 5f30514 commit c299d90
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 34 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/dynare-6.2-matlab-r2024b-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,12 @@ jobs:
matrixAlgebraLyapunovComparison;
VARpDimensionsIllustration;
threeVariableVAROLS;
threeVariableVARML;
threeVariableVARML;
- name: Run week 7 codes
uses: matlab-actions/run-command@v2
with:
command: |
addpath("Dynare-6.2-arm64/matlab");
cd("progs/matlab");
USOil;
10 changes: 9 additions & 1 deletion .github/workflows/dynare-6.2-matlab-r2024b-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,12 @@ jobs:
matrixAlgebraLyapunovComparison;
VARpDimensionsIllustration;
threeVariableVAROLS;
threeVariableVARML;
threeVariableVARML;
- name: Run week 7 codes
uses: matlab-actions/run-command@v2
with:
command: |
addpath("dynare/matlab");
cd("progs/matlab");
USOil;
10 changes: 9 additions & 1 deletion .github/workflows/dynare-6.2-matlab-r2024b-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,12 @@ jobs:
matrixAlgebraLyapunovComparison;
VARpDimensionsIllustration;
threeVariableVAROLS;
threeVariableVARML;
threeVariableVARML;
- name: Run week 7 codes
uses: matlab-actions/run-command@v2
with:
command: |
addpath("D:\hostedtoolcache\windows\dynare-6.0\matlab");
cd("progs/matlab");
USOil;
22 changes: 16 additions & 6 deletions exercises/identification_problem_svar.tex
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
\section[Identification Problem in Structural Vector Autoregressive Models]{Identification Problem in Structural Vector Autoregressive Models\label{ex:IdentificationProblemSVAR}}
Consider a simple 2-variable model:
\begin{align*}
i_t &= \beta \pi_t + \gamma_1 i_{t-1} + \gamma_2 \pi_{t-1} + \varepsilon_t^{MP} \\
i_t &= \beta \pi_t + \gamma_1 i_{t-1} + \gamma_2 \pi_{t-1} + \varepsilon_t^{MP}
\\
\pi_t &= \delta i_t + \gamma_3 i_{t-1} + \gamma_4 \pi_{t-1} + \varepsilon_t^{\pi}
\end{align*}
where \(i_t\) denotes the interest rate set by the central bank and \(\pi_t\) the inflation rate.
Assume for the \textbf{structural shocks}:
\(\varepsilon_{t}=(\varepsilon_t^{MP}, \varepsilon_t^{\pi})' \sim N(0,\Sigma_\varepsilon)\).

\begin{enumerate}
\item Rewrite the model in a compact matrix form \(B_0 y_t = B_1 y_{t-1} + \varepsilon_{t}\).
Note that this is a structural VAR(1) model.
\item Since the structural VAR model is not directly observable, derive the reduced-form representation:

\item
Rewrite the model in a compact matrix form \(B_0 y_t = B_1 y_{t-1} + \varepsilon_{t}\).
Note that this is a structural VAR{(1)} model.

\item
Since the structural VAR model is not directly observable, derive the reduced-form representation:
\(y_t = A_1 y_{t-1} + u_t\).
What is the relationship between structural shocks \(\varepsilon_t\) and reduced-form residuals \(u_t\)?
\item In your own words, explain the identification problem in SVAR models.

\item
In your own words, explain the identification problem in SVAR models.
Provide intuition behind the popular identification assumptions of short-run, long-run and sign restrictions.

\end{enumerate}

\paragraph{Readings}
\begin{itemize}
\item \textcite[Ch.~7.6]{Kilian.Lutkepohl_2017_StructuralVectorAutoregressive}
\item \textcite{Wolf_2022_WhatCanWe}
\end{itemize}

\begin{solution}\textbf{Solution to \nameref{ex:IdentificationProblemSVAR}}
\ifDisplaySolutions
\ifDisplaySolutions%
\input{exercises/identification_problem_svar_solution.tex}
\fi
\newpage
Expand Down
68 changes: 47 additions & 21 deletions exercises/identification_problem_svar_solution.tex
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
\begin{enumerate}

\item Rewrite the equations:
\item
Rewrite the equations:
\begin{align*}
i_t - \beta \pi_t &= \gamma_1 i_{t-1} + \gamma_2 \pi_{t-1} + \varepsilon_t^{MP}\\
i_t - \beta \pi_t &= \gamma_1 i_{t-1} + \gamma_2 \pi_{t-1} + \varepsilon_t^{MP}
\\
\pi_t - \delta i_t &= \gamma_3 i_{t-1} + \gamma_4 \pi_{t-1} + \varepsilon_t^{\pi}
\end{align*}
or in matrix notation:
\begin{align*}
\underbrace{\begin{pmatrix} 1 & -\beta \\ -\delta & 1 \end{pmatrix}}_{B_0} \underbrace{\begin{pmatrix} i_t \\ \pi_t \end{pmatrix}}_{y_t} = \underbrace{\begin{pmatrix} \gamma_1 & \gamma_2 \\ \gamma_3 & \gamma_4 \end{pmatrix}}_{B_1} \underbrace{\begin{pmatrix} i_{t-1} \\ \pi_{t-1} \end{pmatrix}}_{y_{t-1}} + \underbrace{\begin{pmatrix} \varepsilon_t^{MP} \\ \varepsilon_t^{\pi} \end{pmatrix}}_{\varepsilon_t}
\underbrace{\begin{pmatrix} 1 & -\beta \\ -\delta & 1 \end{pmatrix}}_{B_0}
\underbrace{\begin{pmatrix} i_t \\ \pi_t \end{pmatrix}}_{y_t}
=
\underbrace{\begin{pmatrix} \gamma_1 & \gamma_2 \\ \gamma_3 & \gamma_4 \end{pmatrix}}_{B_1}
\underbrace{\begin{pmatrix} i_{t-1} \\ \pi_{t-1} \end{pmatrix}}_{y_{t-1}}
+
\underbrace{\begin{pmatrix} \varepsilon_t^{MP} \\ \varepsilon_t^{\pi} \end{pmatrix}}_{\varepsilon_t}
\end{align*}

\item Pre-multiply both sides by \(B_0^{-1}\):
\item
Pre-multiply both sides by \(B_0^{-1}\):
\begin{align*}
y_t = \underbrace{B_0^{-1} B_1}_{A_1} y_{t-1} + \underbrace{B_0^{-1} \varepsilon_t}_{u_t}
\end{align*}
Expand All @@ -36,40 +45,57 @@
u_t^{\pi} = c \varepsilon_t^{MP} + d \varepsilon_t^{\pi}
\end{align*}
Each reduced-form shock is a \textbf{weighted average} of structural shocks,
where \(a,b,c,d\) represents the amounts by which a particular structural shock contributes to the variation in each residual.
where \(a,b,c,d\) represents the amounts by which a particular structural shock contributes to the variation in each residual.

\item There is not enough information to solve this system of equations, because in \(B_0\) we have 4 unknowns,
but due to symmetry from \(\Sigma_u = B_0^{-1} B_0^{-1'}\) we only have 3 elements in \(\Sigma_u\): two variances and one covariance.
\item
There is not enough information to solve this system of equations, because in \(B_0\) we have 4 unknowns,
but due to symmetry from \(\Sigma_u = B_0^{-1} B_0^{-1'}\) we only have 3 elements in \(\Sigma_u\): two variances and one covariance.
More generally, the covariance structure leaves \(K(K-1)/2\) degrees of freedom in specifying \(B_0^{-1}\)
and hence further restrictions are needed to achieve identification.
and hence further restrictions are needed to achieve identification.

Some popular strategies:

\begin{enumerate}
\item Recursive ordering of variables (aka orthogonalization):

\item
Recursive ordering of variables (aka orthogonalization):
In the above example, we would set \(b=0\) to get a lower triangular \(B_0^{-1}\).
The \emph{economics} behind this choice is based on \emph{delay} assumptions,
i.e.\ how long it takes for a variable to react to a certain shock.
The \emph{economics} behind this choice is based on \emph{delay} assumptions, i.e.\
how long it takes for a variable to react to a certain shock.
We can think of the structural shock in terms of the effect it exerts \textbf{contemporaneously} on the variable of interest:
\(\partial y_t = u_t = B_0^{-1} \varepsilon_t\), so we could write:
\(\frac{\partial y_{t}}{\partial \varepsilon_{t}} = u_{t} = B_0^{-1}\), so we could write:
\begin{align*}
\begin{pmatrix} i_t \\ \pi_t \end{pmatrix} = \begin{pmatrix} a & 0 \\ c & d \end{pmatrix} \begin{pmatrix} \varepsilon_t^{MP} \\ \varepsilon_t^{\pi} \end{pmatrix}
\begin{pmatrix} \partial i_t \\ \partial \pi_t \end{pmatrix}
=
\begin{pmatrix} a & 0 \\ c & d \end{pmatrix}
\begin{pmatrix} \partial \varepsilon_t^{MP} \\ \partial \varepsilon_t^{\pi} \end{pmatrix}
\end{align*}
This lower triangular structure can be obtained by e.g.\ a Cholesky decomposition of \(\Sigma_u\) and yields \textbf{exact identification}.
This lower triangular structure can be obtained by e.g.\
a Cholesky decomposition of \(\Sigma_u\) and yields \textbf{exact identification}.
The order of variables, however, matters!
\item Short-run restrictions: Exclusion restrictions on the impact matrix \(B_0^{-1}\), more flexible than orthogonalization.
\item Separating transitory from permanent components by assuming long-run structural relationships,
i.e.\ on the long-run multiplier matrix \({(I-A(L))}^{-1} B_0^{-1}\).
\item Combination of short-run and long-run relationships.
\item Sign restrictions: Take the Cholesky decomposition which yields exact identification \(\Sigma_u = B_0^{-1}B_0^{-1'} = P P'\).

\item
Short-run restrictions: Exclusion restrictions on the impact matrix \(B_0^{-1}\), more flexible than orthogonalization.

\item
Separating transitory from permanent components by assuming long-run structural relationships,
i.e.\ on the long-run multiplier matrix \({(I-A(L))}^{-1} B_0^{-1}\).

\item
Combination of short-run and long-run relationships.

\item
Sign restrictions: Take the Cholesky decomposition which yields exact identification \(\Sigma_u = B_0^{-1}B_0^{-1'} = P P'\).
In this special case: \({B_0}^{-1}=P\), but this is just \textbf{ONE} possible solution.
It is also possible to decompose \(\Sigma_u = \tilde{P}\tilde{P}'\), where \(\tilde{P} = PQ'\) and \(Q\) is an orthogonal rotation matrix: \(Q'Q = QQ'=I\);
that is, \(\tilde{P}\) and \(P\) are \textbf{observationally equivalent}, because they both reproduce \(\Sigma_u\).
that is, \(\tilde{P}\) and \(P\) are \textbf{observationally equivalent}, because they both reproduce \(\Sigma_u\).
\(Q\) is called a rotation matrix because it allows us to \emph{rotate} the initial Cholesky (recursive) matrix while maintaining the property that shocks are uncorrelated.
Put differently, it helps us generate new weights!
This is the basic idea of sign restrictions:
Examine a large number of candidate impact matrices by repeatedly drawing at random from the set of orthogonal matrices \(Q\).
For each \(B_0^{-1}\) check whether the candidate impact matrix is compatible with the sign restrictions that characterize a certain structural shock.
Then we construct the set of admissable models based on accepted draws.
Then we construct the set of admissible models based on accepted draws.

\end{enumerate}

\end{enumerate}
6 changes: 3 additions & 3 deletions exercises/svar_irf.tex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
\section[Structural Impulse Response Function]{Structural Impulse Response Function\label{ex:StructuralImpulseResponseFunction}}
Consider the structural VAR(p) model
Consider the structural VAR{(p)} model
\begin{align*}
B_0y_t = B_1 y_{t-1} + \cdots + B_{p} y_{t-p} + \varepsilon_{t}
\end{align*}
where the dimension of \(B_i\), \(i = 0,\ldots ,p\), is \(K \times K\).
The \(K \times 1\) vector of structural shocks \(\varepsilon_{t}\) is assumed to be white noise with covariance matrix \(E(\varepsilon_t \varepsilon_t') = I_K\).
That is, the elements of \(\varepsilon_t\) are mutually uncorrelated and also have a clear interpretation in terms on an underlying economic model.
The reduced-form VAR(p) model is given by
The reduced-form VAR{(p)} model is given by
\begin{align*}
y_t = \underbrace{B_0^{-1}B_1}_{A_1}y_t + \cdots + \underbrace{B_0^{-1}B_p}_{A_p} y_{t-p} + \underbrace{B_0^{-1}\varepsilon_t}_{u_t}
\end{align*}
Expand All @@ -23,7 +23,7 @@
\item Usually the objective is to plot the responses of each variable to each structural shock.
How many so-called impulse response functions do we need to plot?

\item Consider the VAR(1) representation of the VAR(p) process, i.e.\
\item Consider the VAR{(1)} representation of the VAR{(p)} process, i.e.\
\begin{align*}
Y_t = A Y_{t-1} + U_t
\end{align*}
Expand Down
2 changes: 1 addition & 1 deletion exercises/svar_recursive.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\section[Recursively Identified Models]{Recursively Identified Models\label{ex:RecursivelyIdentifiedModels}}
A popular argument in macroeconomics has been that oil price shocks in particular may act as domestic supply shocks for the U.S. economy.
Thus, the question of how oil price shocks affect U.S. real GDP and inflation has a long tradition in macroeconomics.
Postulate a VAR(4) model with intercept for the percent changes in the real WTI price of crude oil (\(\Delta rpoil_t\)),
Postulate a VAR{(4)} model with intercept for the percent changes in the real WTI price of crude oil (\(\Delta rpoil_t\)),
the U.S. GDP deflator inflation rate (\(\Delta p_t\)),
and U.S. real GDP growth (\(\Delta gdp_t\)).
Consider the dataset given in \enquote{USOil.csv}.
Expand Down
30 changes: 30 additions & 0 deletions week_7.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
% !TEX root = week_7.tex
\input{exercises/_common_header.tex}
\Newassociation{solution}{Solution}{week_7_solution}
\newif\ifDisplaySolutions\DisplaySolutionstrue%

\begin{document}
\title{Quantitative Macroeconomics\\~\\Winter 2024/25\\~\\Week 7}
\author{Willi Mutschler\\willi@mutschler.eu}
\date{Version: 1.0\\Latest version available on: \href{https://github.com/wmutschl/Quantitative-Macroeconomics/releases/latest/download/week_7.pdf}{GitHub}}
\maketitle\thispagestyle{empty}

\newpage
\Opensolutionfile{week_7_solution}[week_7_solution]
\tableofcontents\thispagestyle{empty}\newpage

\setcounter{page}{1}
\input{exercises/identification_problem_svar.tex}\newpage
\input{exercises/svar_irf.tex}\newpage
\input{exercises/svar_recursive.tex}\newpage
\printbibliography%
\newpage

\Closesolutionfile{week_7_solution}
\ifDisplaySolutions%
\newpage
\appendix
\section{Solutions}
\input{week_7_solution}
\fi
\end{document}

0 comments on commit c299d90

Please sign in to comment.