The rejection sampler: : sippi_rejection.m
The rejection sampler provides a simple, and also in many cases inefficient, approach to sample the posterior distribution.
At each iteration of the rejection sample an independent realization, m_pro, of the prior is generated, and the model is accepted as a realization of the posterior with probability Pacc = L(m_pro)/L_max. It can be initiated using
options.mcmc.nite=400000; % Number of iteration, defaults to 1000
options.mcmc.i_plot=500; % Number of iteration between visual updates, defaults to 500
options=sippi_rejection(data,prior,forward,options);
By default the rejection sampler is run assuming a maximum likelihood of
1 (i.e. L_max = 1). If L_max is known, then it can be set using in the
options.Lmax
or options.logLmax
fields
options.mcmc.Lmax=1e-9;
options=sippi_rejection(data,prior,forward,options);
or
options.mcmc.logLmax=log(1e-9);
options=sippi_rejection(data,prior,forward,options);
Alternatively, L_max can be automatically adjusted to reflect the maximum likelihood found while running the rejection sampler using
options.mcmc.adaptive_rejection=1
options=sippi_rejection(data,prior,forward,options);
An alternative to rejection sampling, also utilizing independent realizations of the prior, that does not require one to set L_max is the independent extended metropolis sampler, which may be computatinoally superior to the rejection sampler,