Make sure fast_kalman_filter is only used with diffuse_periods=0

Closes #1234
time-shift
Johannes Pfeifer 2016-06-19 17:00:05 +02:00 committed by Stéphane Adjemian (Hermes)
parent af72c1bd22
commit 75e52ed71d
3 changed files with 16 additions and 2 deletions

View File

@ -5849,8 +5849,9 @@ singularity is encountered, Dynare by default automatically switches to the univ
@item fast_kalman_filter
@anchor{fast_kalman_filter} Select the fast Kalman filter using Chandrasekhar
recursions as described by @cite{Herbst, 2015}. This setting is only used with
@code{kalman_algo=1} or @code{kalman_algo=3}. It is not yet compatible with
@code{analytical_derivation}.
@code{kalman_algo=1} or @code{kalman_algo=3}. In case of using the diffuse Kalman
filter (@code{kalman_algo=3/lik_init=3}), the observables must be stationary. This option
is not yet compatible with @code{analytical_derivation}.
@item kalman_tol = @var{DOUBLE}
@anchor{kalman_tol} Numerical tolerance for determining the singularity of the covariance matrix of the prediction errors during the Kalman filter (minimum allowed reciprocal of the matrix condition number). Default value is @code{1e-10}

View File

@ -655,6 +655,17 @@ if ((kalman_algo==1) || (kalman_algo==3))% Multivariate Kalman Filter
[err, LIK] = block_kalman_filter(T,R,Q,H,Pstar,Y,start,Z,kalman_tol,riccati_tol, Model.nz_state_var, Model.n_diag, Model.nobs_non_statevar);
mexErrCheck('block_kalman_filter', err);
elseif DynareOptions.fast_kalman_filter
if diffuse_periods
%kalman_algo==3 requires no diffuse periods (stationary
%observables) as otherwise FE matrix will not be positive
%definite
fval = Inf;
info(1) = 55;
info(4) = 0.1;
exit_flag = 0;
return
end
[LIK,lik] = kalman_filter_fast(Y,diffuse_periods+1,size(Y,2), ...
a,Pstar, ...
kalman_tol, riccati_tol, ...

View File

@ -123,6 +123,8 @@ if ~noprint
error('You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!')
case 52 %dsge_var_likelihood
error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations is not positive definite!');
case 55
error('Fast Kalman filter only works with stationary models [lik_init=1] or stationary observables for non-stationary models [lik_init=3]')
case 61 %Discretionary policy
error(['Discretionary policy: maximum number of iterations has been reached. Procedure failed. ']);
case 62