From fbe91646f035555011cbaee4be81f2d21b3fbed6 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Tue, 31 May 2022 17:36:48 +0200 Subject: [PATCH] PKF: document incompatibilities and throw proper errors if triggered (manually cherry picked from commit 8ac72590dab13305f2b08896d8d130c41e6fc0a9) --- doc/manual/source/the-model-file.rst | 12 ++++++++++-- matlab/initial_estimation_checks.m | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index 107a91c527..5976044bff 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -4870,6 +4870,11 @@ All of these elements are discussed in the following. to NaN and the standard deviation of the associated shock set to 0 for the corresponding periods using the ``heteroskedastic_shocks``-block. + Note that models with unit roots will require the user to specify the ``diffuse_filter``-option as + otherwise Blanchard-Kahn errors will be triggered. For the piecewise Kalman filter, the + initialization steps in the diffuse filter will always rely on the model solved for the baseline + regime, without checking whether this is the actual regime in the first period(s). + *Example* :: @@ -4978,7 +4983,8 @@ All of these elements are discussed in the following. .. option:: likelihood_piecewise_kalman_filter Employ the piecewise Kalman filter of *Giovannini, Pfeiffer, and Ratto (2021)* when estimating - the model. Default: enabled. + the model. Note that this filter is incompatible with univariate Kalman filters, i.e. ``kalman_algo=2,4``. + Default: enabled. .. option:: likelihood_max_kalman_iterations @@ -6991,7 +6997,9 @@ block decomposition of the model (see :opt:`block`). Koopman (2012)* and *Koopman and Durbin (2003)* for the multivariate and *Koopman and Durbin (2000)* for the univariate filter) to estimate models with non-stationary observed - variables. + variables. This option will also reset the ``qz_criterium`` to + count unit root variables towards the stable variables. Trying to estimate + a model with unit roots will otherwise result in a Blanchard-Kahn error. When ``diffuse_filter`` is used the ``lik_init`` option of ``estimation`` has no effect. diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m index 9cf98c82f8..27717a15ae 100644 --- a/matlab/initial_estimation_checks.m +++ b/matlab/initial_estimation_checks.m @@ -20,7 +20,7 @@ function DynareResults = initial_estimation_checks(objective_function,xparam1,Dy % SPECIAL REQUIREMENTS % none -% Copyright (C) 2003-2018 Dynare Team +% Copyright © 2003-2022 Dynare Team % % This file is part of Dynare. % @@ -80,6 +80,12 @@ if DynareOptions.occbin.likelihood.status || DynareOptions.occbin.smoother.statu if DynareOptions.prefilter error('initial_estimation_checks:: Occbin is incompatible with the prefilter option due to the sample mean generally not corresponding to the steady state with an occasionally binding constraint.') end + if ~DynareOptions.occbin.likelihood.inversion_filter && (DynareOptions.kalman_algo==2 || DynareOptions.kalman_algo==4) + error('initial_estimation_checks:: Occbin is incompatible with the selected univariate Kalman filter.') + end + if DynareOptions.fast_kalman_filter + error('initial_estimation_checks:: Occbin is incompatible with the fast Kalman filter.') + end end if (DynareOptions.occbin.likelihood.status && DynareOptions.occbin.likelihood.inversion_filter) || (DynareOptions.occbin.smoother.status && DynareOptions.occbin.smoother.inversion_filter) @@ -323,4 +329,4 @@ end function evaluate_expression(expression,M_,oo_) % function evaluate_expression(expression,M_,oo_) %evaluates expressions relying on M_ and oo_ having their original names -eval(expression); \ No newline at end of file +eval(expression); -- GitLab