# Scale log-likelihood as MCMC sampler advances, to improve acceptance rate

I am working with a rather noisy and multi-modal likelihood. I've found that in order to obtain reasonable results from my Bayesian MCMC sampler (emcee, an affine invariant MCMC ensemble sampler), I need to scale the log-likelihood "on the fly" to ensure the acceptance rate is within the 0.25-0.5 range.

The steps in pseudo-code are:

# Initial log-likelihood scale factor
lkl_scale = 1.

# Run the MCMC N times
for i in 1..N

# One sample from the MCMC sampler, passing the log-likelihood
# and log-prior functions, and the log-likelihood scale factor
sample = mcmc_sampler(log_lkl, log_prior, lkl_scale)

# Obtain the acceptance rate for this step using some function
accpt_rate = accpt_rate_func()

if accpt_rate < 0.25
# If the acceptance rate is too low, reduce the scale factor
lkl_scale = lkl_scale * 0.5
else if accpt_rate > 0.5
# If it is too large, increase it
lkl_scale = lkl_scale * 2.


The line sample = mcmc_sampler(log_lkl, log_prior, lkl_scale) basically returns the sampled $\theta_i$ parameters and the associated lkl_scale * log_lkl + log_prior values (for each chain) for this step.

The lkl_scale factor scales the log-likelihood simply as lkl_scale * log_lkl. This way if lkl_scale is small, it will flatten the log-likelihood which results in larger acceptance rate values, and vice-versa. Notice I do not modify the priors ever.

I've been advised in a previous question that this approach is correct, and that it is similar to annealing or parallel tempering. But this method as far as I understand is based on "swapping between multiple Markov chains run in parallel at different temperatures to accelerate sampling" (Gupta et al. 2018) which I am not doing.

In another question it is stated that if you "flatten" the posterior, then you are effectively sampling from a different posterior and your samples need to be weighted to make sense. Since I am only modifying the log-likelihood, I'm not sure this applies to my case.

My question is then: is this approach statistically reasonable? If not, then: what if I were to scale my log-likelihood just once before launching the MCMC sampler (using a value that I know produces good results) Would it be reasonable then?

In short, this method is not statistically valid without further steps.

The function

sample = mcmc_sampler(log_lkl, log_prior, lkl_scale)


should be detailed because, as presented, the method does not appear to be justified. Adding a constant to the likelihood modifies the probability model MCMC simulates from the posterior distribution to a geometric mixture of the prior and posterior distributions. The target of the MCMC is indeed the mixture $$\pi_c(\theta|x)\propto \pi(\theta)f(x|\theta)^c$$This means that the output has to be reweighted by $f(x|\theta)^{1-c}$ or subsampled by accepting only with probability proportional to $$f(x|\theta)^{1-c}$$ Or by using parallel tempering as in Neal (1999).

Furthermore, the constant change of the weight $c$ according to the acceptance rate implies that the target is evolving along time, meaning the Markov chain is no longer time homogeneous, hence that the convergence of the MCMC sampler is in jeopardy. To be validated the algorithm must see the rate of update of the constant c decrease with the iteration index (condition of diminishing adaptation).

• I've edited the question to add this information Xi'an. Please let me know if I should be more specific. I've also added a question regarding a simpler alternative approach (scaling the log-likelihood just once). – Gabriel Sep 12 '18 at 18:18
• Thank you very much for the updated and detailed answer Xi'an. The weird thing is that the method appears to work, which makes it even more deceptive. – Gabriel Sep 13 '18 at 15:21
• What do you exactly mean by "the method appears to work"? I would be highly surprised were it to reproduce the posterior density. – Xi'an Sep 13 '18 at 20:15
• I mean that (using a uniform prior) it gives back reasonable values for my model parameters (ie: what I would expect physically) I don't know the shape of the posterior, so I can't really check anything other than the "reasonability" of the means of the parameters' distributions. – Gabriel Sep 13 '18 at 21:45