DREAMzs | R Documentation |
DREAMzs
DREAMzs( bayesianSetup, settings = list(iterations = 10000, nCR = 3, gamma = NULL, eps = 0, e = 0.05, pCRupdate = FALSE, updateInterval = 10, burnin = 0, thin = 1, adaptation = 0.2, parallel = NULL, Z = NULL, ZupdateFrequency = 10, pSnooker = 0.1, DEpairs = 2, consoleUpdates = 10, startValue = NULL, currentChain = 1, message = FALSE) )
bayesianSetup |
Object of class 'bayesianSetup' or 'bayesianOuput'. |
settings |
list with parameter values |
iterations |
Number of model evaluations |
nCR |
parameter determining the number of cross-over proposals. If nCR = 1 all parameters are updated jointly. |
updateInterval |
determining the intervall for the pCR (crossover probabilities) update |
gamma |
Kurtosis parameter Bayesian Inference Scheme. |
eps |
Ergodicity term |
e |
Ergodicity term |
pCRupdate |
Update of crossover probabilities |
burnin |
number of iterations treated as burn-in. These iterations are not recorded in the chain. |
thin |
thin thinning parameter. Determines the interval in which values are recorded. |
adaptation |
Number or percentage of samples that are used for the adaptation in DREAM (see Details) |
DEpairs |
Number of pairs used to generate proposal |
ZupdateFrequency |
frequency to update Z matrix |
pSnooker |
probability of snooker update |
Z |
starting matrix for Z |
startValue |
eiter a matrix containing the start values (see details), an integer to define the number of chains that are run, a function to sample the start values or NUll, in which case the values are sampled from the prior. |
consoleUpdates |
Intervall in which the sampling progress is printed to the console |
message |
logical determines whether the sampler's progress should be printed |
Insted of a bayesianSetup, the function can take the output of a previous run to restart the sampler
from the last iteration. Due to the sampler's internal structure you can only use the output
of DREAMzs.
If you provide a matrix with start values the number of rows detemines the number of chains that are run.
The number of coloumns must be equivalent to the number of parameters in your bayesianSetup.
There are several small differences in the algorithm presented here compared to the original paper by Vrugt et al. (2009). Mainly
the algorithm implemented here does not have an automatic stopping criterion. Hence, it will
always run the number of iterations specified by the user. Also, convergence is not
monitored and left to the user. This can easily be done with coda::gelman.diag(chain).
Further the proposed delayed rejectio step in Vrugt et al. (2009) is not implemented here.
During the adaptation phase DREAM is running two mechanisms to enhance the sampler's efficiency.
First the disribution of crossover values is tuned to favor large jumps in the parameter space.
The crossover probabilities determine how many parameters are updated simultaneously.
Second outlier chains are replanced as they can largely deteriorate the sampler's performance.
However, these steps destroy the detailed balance of the chain. Consequently these parts of the chain
should be discarded when summarizing posterior moments. This can be done automatically during the
sampling process (i.e. burnin > adaptation) or subsequently by the user. We chose to distinguish between
the burnin and adaptation phase to allow the user more flexibility in the sampler's settings.
mcmc.object containing the following elements: chains, X, pCR, Z
Stefan Paul
Vrugt, Jasper A., et al. "Accelerating Markov chain Monte Carlo simulation by differential evolution with self-adaptive randomized subspace sampling." International Journal of Nonlinear Sciences and Numerical Simulation 10.3 (2009): 273-290.
ter Braak C. J. F., and Vrugt J. A. (2008). Differential Evolution Markov Chain with snooker updater and fewer chains. Statistics and Computing http://dx.doi.org/10.1007/s11222-008-9104-9
DREAM
library(BayesianTools) ll <- generateTestDensityMultiNormal(sigma = "no correlation") bayesianSetup <- createBayesianSetup(likelihood = ll, lower = rep(-10, 3), upper = rep(10, 3)) settings = list(iterations = 200) out <- runMCMC(bayesianSetup = bayesianSetup, sampler = "DEzs", settings = settings) summary(out) # DE family samplers are population MCMCs that run a number of internal chains # in parallel. Here examples how to change the internal chains # note that internal chains can be executedi n parallel settings = list(startValue = 4, iterations = 200) out <- runMCMC(bayesianSetup = bayesianSetup, sampler = "DEzs", settings = settings) summary(out) # Modify the start values of the internal chains (note that this is a matrix # of dim nChain * nPar) settings = list(startValue = matrix(rnorm(12), nrow = 4, ncol = 3), iterations = 200) out <- runMCMC(bayesianSetup = bayesianSetup, sampler = "DEzs", settings = settings) summary(out) # In the DE sampler family with Z matrix, the previous chains are written in # a common matrix, from which proposals are generated. Per default this matrix # is started with samples from the prior, but we can change this. Often useful # to improve sampler convergence, # see https://github.com/florianhartig/BayesianTools/issues/79 settings = list(startValue = matrix(rnorm(12), nrow = 4, ncol = 3), Z = matrix(rnorm(300), nrow = 100, ncol = 3), iterations = 200) out <- runMCMC(bayesianSetup = bayesianSetup, sampler = "DEzs", settings = settings) summary(out)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.