Particle filter dynare

Yes, indeed the particle filter is computationally expensive. That is why we rely on the Kalman filter for linear models.

Where is this user manual for the unstable version. Specifically for the particle filter syntax?

When downloading and installing the unstable version, you can find the up-to-date manual in the doc-folder. It’s called dynare.pdf

By including mode_check, the mode check plots are created. How can we get the parameter trajectories and parameter densities plots to be created? I am able to create them with other estimation programs, but not this one.

Which estimation command exactly did you use?

I have been playing around with the linear_model.mod program.

See github.com/DynareTeam/dynare/blob/master/tests/particle/linear_model.mod

Are the option-options the new, or the old approaches to programming SMC.
For example,

options_.particle.number_of_particles = 20000; options_.particle.resampling.status = 'systematic'; options_.particle.resampling.neff_threshold = .1;

can also be programmed within the estimation command:

or more specifically, my question is which approach is preferable?

Also, is there documentation regarding these options?>

[code]
options_.gstep(1) = 1e-4;
options_.gstep(2) = .1;

options_.mode_check_neighbourhood_size = 0.05;

set_dynare_threads(‘local_state_space_iteration_2’,3);[/code]

In general, you can set any Dynare option manually the way you see it above. If you use the preprocessor interface, all it does is translate the commands to statements like the one above. The preprocessor interface is less prone to mistakes and therefore usually more preferable.

The gstep part is size of the gradient step used in numerical solvers.

mode_check_neighbourhood_size is in the manual.

set_dynare_threads is a command to

[quote]set the number of threads used by some MEX files when compiled
with OpenMP support (i.e with --enable-openmp is given to configure) or any
other parallel library.
[/quote]

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 tests/particle · master · Dynare / dynare · GitLab

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.