Cosmetic changes.
parent
241ccb4f92
commit
1dc71e1b65
66
notes.tex
66
notes.tex
|
@ -37,11 +37,11 @@
|
|||
|
||||
\begin{document}
|
||||
|
||||
|
||||
The evaluation of the likelihood of a linear DSGE model rely on the Kalman
|
||||
filter. If the steady state of the DSGE model is provided in closed form, the
|
||||
Kalman filter is the part of the estimation where most of the time is spent. In
|
||||
this note we evaluate the gain we can obtain by considering an alternative
|
||||
Computing the likelihood of a linear DSGE model's heavily depends on the
|
||||
utilisation of the Kalman filter. When the DSGE model's steady state is already
|
||||
available in a closed form, the estimation process allocates a significant
|
||||
portion of its time to the Kalman filter. In this document, we aim to quantify
|
||||
the potential benefits that may arise from considering an alternative
|
||||
initialisation of the Kalman filter.\newline
|
||||
|
||||
The reduced form DSGE model is given by:
|
||||
|
@ -59,11 +59,12 @@ variables, the vector of observed endogenous variables is:
|
|||
\[
|
||||
y^{\star}_t = Z y_t
|
||||
\]
|
||||
where $Z$ is a $p\times n$ selection matrix\footnote{Here we implicitly exclude,
|
||||
without loss of generality, measurement errors.}. The likelihood, the density
|
||||
of the sample, can be expressed as a product of the condition (Gaussian)
|
||||
where $Z$ is a $p\times n$ selection matrix\footnote{Here, without loss of
|
||||
generality, we implicitly exclude measurement errors.}. The likelihood, the
|
||||
density of the sample, can be expressed as a product of the (Gaussian) conditional
|
||||
densities of the prediction errors $v_t$ which are determine recursively with
|
||||
the Kalman filter:
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:kalman:1}
|
||||
v_t = y_t^{\star} - \bar y^{\star}- Z \hat y_t
|
||||
|
@ -99,10 +100,12 @@ for the conditional covariance matrix of the endogenous variables:
|
|||
\label{eq:ricatti}
|
||||
P_{t+1} = A P_t A' - A P_t Z' \left(Z P_t Z \right)^{-1}Z A P_t A' + B \Sigma_{\varepsilon}B'
|
||||
\end{equation}
|
||||
This is the Ricatti equation, where most of the time is spent when evaluating
|
||||
the Kalman filter and where round off errors can accumulate dramatically. When
|
||||
iterating over these equations the Ricatti equation will eventually (provided
|
||||
the sample is large enough) converge to a fixed point $\bar P$ satisfying:
|
||||
This is the Riccati equation, which consumes a significant portion of the
|
||||
computation time during the evaluation of the Kalman filter. Additionally, it is
|
||||
a critical point where round-off errors can accumulate significantly. As we
|
||||
iterate through these equations, the Riccati equation will ultimately, given a
|
||||
sufficiently large sample size, converge to a fixed point denoted as $\bar P$,
|
||||
which satisfies the following:
|
||||
\begin{equation}
|
||||
\label{eq:ricatti:fp}
|
||||
A \bar P A' - \bar P - A \bar P Z' \left(Z \bar P Z \right)^{-1}Z A \bar P A' + B \Sigma_{\varepsilon}B' = 0
|
||||
|
@ -114,12 +117,12 @@ and the Kalman filter equations fall down into the following system:
|
|||
\hat y_{t+1} &= A \hat y_t + \bar K v_t
|
||||
\end{cases}
|
||||
\]
|
||||
referred as the steady state Kalman filter, with $\bar F = Z \bar P Z'$ and
|
||||
$\bar K = A \bar P A' Z' \bar F^{-1}$, on which iterations take obviously much
|
||||
less time than with system (\ref{eq:kalman:1})--(\ref{eq:kalman:5}). The number
|
||||
of iterations required to (approximately) converge to the steady state does not
|
||||
depend on the data but only on the persistence in the model (through matrix
|
||||
$A$).\newline
|
||||
referred to as the steady state Kalman filter, with $\bar F = Z \bar P Z'$ and a
|
||||
constant Kalman gain matrix $\bar K = A \bar P A' Z' \bar F^{-1}$. Iterations are
|
||||
then significantly faster compared to the system described by
|
||||
(\ref{eq:kalman:1})--(\ref{eq:kalman:5}). The number of iterations required to
|
||||
(approximately) converge to the steady state does not depend on the data but only
|
||||
on the persistence in the model (through matrix $A$).\newline
|
||||
|
||||
Due to its recursive nature, the Kalman filter requires an initial condition
|
||||
$\hat y_0$ and $P_0$. Assuming that the model is stationary, a usual choice for
|
||||
|
@ -132,23 +135,24 @@ which is a Sylvester equation that can be easily solved.\newline
|
|||
|
||||
In this note we consider instead the fixed point of the Ricatti equation
|
||||
$\bar P$ as an initial condition for the covariance matrix of the endogenous
|
||||
variables. The computational advantage is obvious: we directly jump to the
|
||||
steady state Kalman filter and never go through
|
||||
variables. This approach offers a clear computational advantage: we directly jump to the
|
||||
steady state Kalman filter without the need to go through
|
||||
(\ref{eq:kalman:1})--(\ref{eq:kalman:5}). Clearly this will reduce the time
|
||||
required to compute the likelihood, but this will also change the evaluation of
|
||||
the likelihood. Using a medium scaled model we quantify the saved the computing
|
||||
time and evaluate the consequences for the estimation of the parameters. Dynare
|
||||
the likelihood. To assess the impact of this alternative initial condition, we
|
||||
conduct experiments using a medium-sized model, quantifying the time savings and
|
||||
evaluating their implications on parameter estimation. Dynare
|
||||
provides a MEX file, linked to the subroutine \verb+sb02od+ from the
|
||||
\href{http://www.slicot.org/}{Slicot library} (version 5.0), to solve
|
||||
(\ref{eq:ricatti:fp}) for $\bar{P}$. The use of $\bar P$ as an initial condition
|
||||
for the Kalman filter is triggered by option \verb+lik_init=4+ in the
|
||||
\verb+estimation+ command.\newline
|
||||
|
||||
We consider the estimation of the Quest-III model (113 endogenous variables, 19
|
||||
We consider\footnote{The test environment consists of an 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz with 32 GB memory , using MATLAB R2023b under Debian GNU/Linux.} the estimation of the Quest-III model (113 endogenous variables, 19
|
||||
innovations, 17 observed variables) as an example. All the codes to reproduce
|
||||
the results are available available in a
|
||||
\href{https://git.dynare.org/stepan-a/quest-iii-estimation}{Git repository}. The
|
||||
model is estimated under both settings (initialization with $\bar P$, RFP, or
|
||||
the results are available in a
|
||||
\href{https://git.ithaca.fr/stepan-a/quest-iii-estimation}{Git repository}. The
|
||||
model is estimated under both settings (initialization with $\bar P$, or
|
||||
with $P^{\star}$)\footnote{To reproduce the results run \verb+Q3.mod+, provided
|
||||
in the root of the Git repository, with macro options
|
||||
\verb+-DUSE_RICATTI_FIXED_POINT=true+ and
|
||||
|
@ -159,10 +163,10 @@ fixed point of the Ricatti equation ($\bar P$). Because the objective functions
|
|||
are different, the optimiser probably do not behave identically in both cases.
|
||||
If we just evaluate the likelihood on the same point (the prior mean), instead
|
||||
of running \verb+mode_compute=5+, we find that the evaluation with $P^{\star}$
|
||||
is just 21\% slower than the evaluation with $\bar P$, suggesting that
|
||||
initialising with the fixed point of the Ricatti equation makes the objective
|
||||
easier to optimise. This is expected since it is well known that
|
||||
iterations on (\Ref{eq:ricatti}) are not well behaved. The values of the logged
|
||||
is just 21\% slower than the evaluation with $\bar P$, indicating that initialising
|
||||
with the fixed point of the Riccati equation renders the objective more amenable to
|
||||
optimisation. This is expected since it is widely recognised that
|
||||
iterations on (\Ref{eq:ricatti}) exhibit erratic behaviour. The values of the logged
|
||||
posterior kernel at the estimated posterior mode are close (7235.92 with
|
||||
$\bar P$ and 7237.68 with $P^{\star}$). But much larger differences can be
|
||||
observed elsewhere. For instance, at the prior mean the values are -275.58 with
|
||||
|
@ -178,7 +182,7 @@ plain curves for the initialisation with $P^{\star}$, red dashed curves for the
|
|||
initialisation with $\bar P$). The conclusion seems to be that even if the
|
||||
likelihood functions are different, inference on the parameters is only
|
||||
marginally affected. At least for a first attempt, we can safely consider the
|
||||
alternative initialisation of the Kalman filter. We should try also to compare
|
||||
alternative initialisation of the Kalman filter. We should also try to compare
|
||||
posterior densities, running samplers under both settings, this would bring a
|
||||
more definitive answer (at least in the case of Quest-III). Ideally we should
|
||||
also build a Monte-Carlo exercise, on a smaller model. All this is left for
|
||||
|
|
Loading…
Reference in New Issue