factorizing posterior samplers + inclusion of slice sampler

I am going to make a pull request from by personal branch https://github.com/rattoma/dynare/tree/slice

the aim is to add a new posterior sampler, SLICE, but also to make it easier to add further new ones. There is a bunch of common codes in random walk, independent, TARB, etc. and I did not want to follow that route.

So I wrote, adapting from random walk algorithm, a new general set of routines posterior_sampler_* that factorizes the iteration of individual samplers, but the rest of the engine is common: initialization, parallelization, bars, load_mh_file etc...

The current implementation fully integrates:

  • random walk MH
  • independent MH
  • slice

It also contains a quick fix for TARB but the latter could be easily fully integrated in the new framework.

An open issue concerns adaptive_metropolis_hastings.m [last commit in 2013], which cannot be easily integrated, so I trapped it in dynare_estimation_1.m keeping the old framework.

Concerning pre-processor provisions, this commit would require:

  1. enable slice as new sampler method: options_.posterior_sampling_method = 'slice';
  2. enable a form of flexible method specific options, along the lines of optimizers options. would this be possible? To explain better: I added a new option field options_.posterior_sampler_options that can contain method specific options. one could specify a syntax like sampler_options=(NAME, VALUE, etc..)

with name/value pairs. These will be stored as fields of options_.posterior_sampler_options

So the command estimation(posterior_sampling_method = slice, sampler_options=('rotated',1), ...)

would trigger

options_.posterior_sampler_options.rotated = 1

what do you think?