Page 2 of 2

Re: particle filter dynare

PostPosted: Sun Oct 30, 2016 8:07 am
by jpfeifer
When downloading and installing the unstable version, you can find the up-to-date manual in the doc-folder. It's called dynare.pdf

Re: particle filter dynare

PostPosted: Wed Nov 02, 2016 12:12 am
by shengan28
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.

Re: particle filter dynare

PostPosted: Wed Nov 02, 2016 8:49 am
by jpfeifer
Which estimation command exactly did you use?

Re: particle filter dynare

PostPosted: Tue Dec 27, 2016 1:55 am
by shengan28
I have been playing around with the linear_model.mod program.

See https://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,
Code: Select all
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:

Code: Select all
estimation(order=2,nobs=100,mode_compute=8, mode_check,datafile=linear_model_data,mh_replic=0, filter_algorithm=sis, resampling=systematic, resampling_threshold=.1,  mode_file=linear_model_mode);


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

Also, is there documentation regarding these options?>
Code: Select all
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);

Re: particle filter dynare

PostPosted: Tue Dec 27, 2016 6:37 am
by jpfeifer
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.

Code: Select all
mode_check_neighbourhood_size
is in the manual.

set_dynare_threads is a command to
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.

Re: particle filter dynare

PostPosted: Wed Dec 28, 2016 3:33 am
by shengan28
That is good insight. Thanks.

My next question has to do with programming Particle filters.
The command
Code: Select all
filter_algorithm=sis

is the sequential importance sampling. However, by adding

Code: Select all
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
Code: Select all
mode_compute=11
runs the on-line estimation. Does this option over ride the particle filters in the
Code: Select all
filter_algorithm=

command?

Re: particle filter dynare

PostPosted: Sun Jan 01, 2017 7:57 am
by jpfeifer
Concerning the first question on
Code: Select all
filter_algorithm=sis
and
Code: Select all
resampling=systematic
the answer is yes. And it is the default.
Code: Select all
resampling_threshold
only works with
Code: Select all
generic
and is useless with
Code: Select all
systematic
or
Code: Select all
none
. With
Code: Select all
apf
it induces a second resampling step on current particles which is not necessary. The literature then recommands
Code: Select all
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
Code: Select all
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.

Re: particle filter dynare

PostPosted: Tue Jan 10, 2017 5:40 am
by shengan28
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.

Re: particle filter dynare

PostPosted: Tue Jan 17, 2017 11:23 am
by jpfeifer
Could you please provide the mod-file

Re: particle filter dynare

PostPosted: Sat Jan 21, 2017 7:27 pm
by shengan28
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 KiB) Downloaded 51 times


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
Code: Select all
mode_file=linear_model_mode
in the estimation command.

Thanks for looking into this bug.

~Shawn

Re: particle filter dynare

PostPosted: Mon Jan 23, 2017 11:21 am
by jpfeifer
You may try it again with the proposed change at https://github.com/DynareTeam/particles/pull/8