Commit 76e3c6ca authored by Stéphane Adjemian's avatar Stéphane Adjemian

Removed unnecessary parts of the code.

 - Call resol instead of dynare_resolve.
 - Removed definition of constant and trend which are not used in nonlinear filters.
 - Cosmetic changes.
parent 6418e225
......@@ -144,7 +144,7 @@ end
% Linearize the model around the deterministic sdteadystate and extract the matrices of the state equation (T and R).
[T,R,SteadyState,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,DynareOptions,DynareResults,'restrict');
[dr, info, Model, DynareOptions, DynareResults] = resol(0, Model, DynareOptions, DynareResults);
if info(1)
if info(1) == 3 || info(1) == 4 || info(1) == 5 || info(1)==6 ||info(1) == 19 || ...
......@@ -166,34 +166,14 @@ end
% Define a vector of indices for the observed variables. Is this really usefull?... = BayesInfo.mf1;
% Define the deterministic linear trend of the measurement equation.
if DynareOptions.noconstant
constant = zeros(DynareDataset.vobs,1);
constant = SteadyState(BayesInfo.mfys);
% Define the deterministic linear trend of the measurement equation.
if BayesInfo.with_trend
  • @stepan-a You removed this part because the particle filter is not able to handle this. But do we provide an error in this case? If not, the user will get wrong results.

  • @JohannesPfeifer Normally we take into account the constant via the structure ReducedForm (line 172 in non_linear_dsge_likelihood), this part was not used that's why I removed the codes related to the constant. But you are right regarding the following lines about the trend. I believe this part never worked, I do not really know how to deal with the trends if the order of approximation is greater than 1. I will add an error message and document this limitation.

  • Let's put my question regarding the constant differently: if I specify the prefilter option, will I get correct results?

  • It depends on what you call a correct result... I believe you have exactly the same issue with a first order approximation. If you prefilter the data before estimation, you will miss long run restrictions on the levels (at second order these restrictions imply a convolution of the deterministic steady state and the variances, at first order these restriction are only related to the deterministic steady state).

  • No, I mean at a more basic level that the mean is taken out of the data and therefore the model must also work without the mean/constant and that the mean should later be added back again.

  • You're right. Nonlinear filters cannot be used with prefilter option and we should return an error if a user attempts to do that. We cannot simply remove the constant (y^{\star}+\frac{1}{2}g_{\sigma\sigma}) from the model, as we do with a first order approximation, since even without the constant the ergodic mean associated with the second order reduced form would be non zero. I suppose that what we should do, but I leave that for 4.7, is to remove the ergodic mean from y when iterating on the nonlinear state space model.

Please register or sign in to reply
[trend_addition, trend_coeff]=compute_trend_coefficients(Model,DynareOptions,DynareDataset.vobs,DynareDataset.nobs);
trend = repmat(constant,1,;
trend = repmat(constant,1,DynareDataset.nobs);
% Get needed informations for kalman filter routines.
start = DynareOptions.presample+1;
np = size(T,1);
mf =;
Y = transpose(;
% 3. Initial condition of the Kalman filter
% Get decision rules and transition equations.
dr = DynareResults.dr;
% Set persistent variables (first call).
if isempty(init_flag)
mf0 = BayesInfo.mf0;
......@@ -280,7 +260,7 @@ if isnan(fval)
if imag(fval)~=0
if ~isreal(fval)
fval = Inf;
info(1) = 48;
info(4) = 0.1;
......@@ -288,7 +268,7 @@ if imag(fval)~=0
if isinf(LIK)~=0
if isinf(LIK)
fval = Inf;
info(1) = 50;
info(4) = 0.1;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment