florianhartig / BayesianTools

General-Purpose MCMC and SMC Samplers and Tools for Bayesian Statistics
https://cran.r-project.org/web/packages/BayesianTools/index.html
115 stars 29 forks source link

How to pre-tune proposal function #217

Closed florianhartig closed 3 years ago

florianhartig commented 3 years ago

Question from a user:

Wie kann ich eine multivariate "jump distribution" vorgeben, die für das Ziehen des "Proposals" eines i+1'ten Parametervektors angenommen wird ?

Man kann Rechenzeit während des burn-ins einsparen, in dem eine gut geschätzte multivariate Verteilung dafür schon zu Beginn gegeben wird. Ich habe ein Boden-Pflanzenmodel, welches ca 1 min (im günstigsten Fall, in ungünstigeren Fällen ~ 3min) Rechenzeit benötigt. Ich bin wirklich auf eine schnelles burn-in angewiesen.

florianhartig commented 3 years ago

How to pre-tune the proposal depends on the sampler

I would not recommend Metropolis sampling for slow models, so assuming that you use e.g. DEzs, which is a robust MCMC for complex slow models, what one would do is:

florianhartig commented 3 years ago

Reply:

In the past I did global optimisation + FOSM calculation of the parameters variance-covariance matrix, followed by MCMC (DRAM) sampling of the posterior around the "best fit". The reason was, Differential Evolution is formidable for parallel computating, while for MCMC chains, this is less so. I then start n chains around the best fit.

You answered:==> For Metropolis samplers, the covariance of the proposal generator can be set

Where, for example in BayesianTools::DRAM(startValue = NULL, iterations = 10000, nBI = 0, parmin = NULL, parmax = NULL, FUN, f = 1, eps = 0), is this done?

Via argument FUN, or through a matrix of startValues?

florianhartig commented 3 years ago

First of all, I would still not recommend to use DRAM, DEzs will work better. The internal DEzs chains can be partly parallelized in BT, default is 3, but you can increase if you want to have have more cores available. But even without parallelization, DEzs is more efficient than DRAM in my experience.

That being said, if you insist on using DRAM, you can set the proposalGenerator in the setup via https://rdrr.io/cran/BayesianTools/man/createProposalGenerator.html