Particle filter dynare

That is good insight. Thanks.

My next question has to do with programming Particle filters.
The command filter_algorithm=sis
is the sequential importance sampling. However, by adding

resampling=systematic or generic
Doe this make the particle filter the sequential importance resampling filter? It seems obvious, but the manual does not explicitly say this.

Does this option work with any of the other filters? It must not do anything to the APF

Lastly, the mode_compute=11 runs the on-line estimation. Does this option over ride the particle filters in the filter_algorithm=
command?

Concerning the first question on filter_algorithm=sis and resampling=systematic the answer is yes. And it is the default.

resampling_threshold only works with generic and is useless with systematic or none. With apf it induces a second resampling step on current particles which is not necessary. The literature then recommands resampling=none for apf.

Keep in mind that maximum likelihood will not function in presence of resampling since it generates a discontinuity of the criterion with respect to the structural parameters. In that case, avoid gradient-based methods.

Concerning mode_compute=11 it is an auxiliary particle filter and it overrides the other options that control other particle filters. It is useful to obtain fast estimation on parameters by including them as extra states but suffers from a severe lack of theoretical foundations.

Thank you for the detailed reply. That makes things clear.
Can someone check the NKLF option with the linear_model.mod . It runs for several minutes before crashing.

Could you please provide the mod-file

The NLKF filter starts out strong, but then crashes at Simplex iteration number: 4964-4-3, maybe after 20 minutes.

linear_model_nlkf.mod (1.44 KB)

Notice that this file expects the linear_model.mode.mat file, but This board won’t let me upload .mat files. Be sure to eliminate the mode_file=linear_model_mode in the estimation command.

Thanks for looking into this bug.

~Shawn

You may try it again with the proposed change at github.com/DynareTeam/particles/pull/8

Dear Professor Pfeifer,

I learn that dynare 4.6.1 is able to do estimation for order higher than 1. While I try to implement the estimation which I have specified as log-linear model. However, the dynare reports that higher order estimation cannot deal with log-lineared model.

error: non_linear_dsge_likelihood (line 59)
non_linear_dsge_likelihood: It is not possible to use a non linear filter with the option loglinear!

I understand that the higher-order estimation or particle filter is relatively new. But is it possible to find any simple example or instruction in the dynare manual on the issue—how to use the estimation command with higher-order properly?

Best,
House

Examples are at https://git.dynare.org/Dynare/dynare/-/tree/master/tests%2Fparticle

Note that the problem is not with using a log-linearized model, but rather you asking to log-linearize a model using Dynare functionality. It is usually better to work with auxiliary equations to get a log-linearization. See

Dear Professor,

Many thanks for your reply. It helps!

Best,
House

Dear Professor Pfeifer,

I try to run the .mod files from tests/particle · master · Dynare / dynare · GitLab. However, after running the .mod files and choosing the mode - finder I get the following error message.

Reference to non-existent field ‘ghs2’.

Error in non_linear_dsge_likelihood (line 179)
ReducedForm.constant = ReducedForm.steadystate + .5*dr.ghs2(restrict_variables_idx);

Error in initial_estimation_checks (line 153)
[fval,info] =
feval(objective_function,xparam1,DynareDataset,DatasetInfo,DynareOptions,Model,EstimatedParameters,BayesInfo,BoundsInfo,DynareResults);

Error in dynare_estimation_1 (line 164)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in noisy_ar1.driver (line 177)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;

I am using dynare 4.6.4. How can I fix it?

Best,
Vahagn

Could you please try the unstable version?

Hi Professor,

Thank You for Your reply, I installed dynare 4.8 the latest unstable version. And now after running the same code I get such an error.
Error using initial_estimation_checks (line 99)
initial_estimation_checks:: particle filtering requires measurement error on the observables

Error in initial_estimation_checks (line 99)
error(‘initial_estimation_checks:: %s requires measurement error on the observables’,disp_string)

Error in dynare_estimation_1 (line 154)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 118)
dynare_estimation_1(var_list,dname);

Error in noisy_ar1.driver (line 179)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

You picked exactly one the files that is not supposed to work. Try e.g. the first_spec.mod.