6
$\begingroup$

I'm writing a simple Metropolis-Hastings MCMC algorithm. Every time a move gets accepted, the point is added to a list of accepted points. I wonder what exactly I should do when a proposed move has been rejected.

  • Should the last accepted point be added to the list again, thus making the list one entry longer,

    or

  • should I not add anything to the list, continuing until finally some new point gets accepted?

$\endgroup$
9
  • $\begingroup$ I am aware of this question: stats.stackexchange.com/questions/30729/… I quote: An example of such an error would be failing to output a value when Metropolis-Hastings rejects a proposed move. Does that mean the last point should be added once again? Thanks! $\endgroup$ Commented Nov 7, 2014 at 17:41
  • $\begingroup$ Wait till you accept. Which is why having a good proposal density is critical. $\endgroup$ Commented Nov 7, 2014 at 17:41
  • 2
    $\begingroup$ I am not sure you can wait until you accept one value. In the general algorithm when you reject a move, you have to add to the list the last accepted value. If you propose a move, reject and then propose a new move, in the MH ratio you have to take into account that you reject one move. $\endgroup$
    – niandra82
    Commented Nov 7, 2014 at 18:07
  • 1
    $\begingroup$ @niandra82 Hmm, I somehow thought the question was about simple AR. In RWMH, what you say is true. Michael, you can see the first example in the Gamerman & Lopes book, chapter 6 for exact code. $\endgroup$ Commented Nov 7, 2014 at 18:40
  • 2
    $\begingroup$ The idea in MH is that you either move or you don't. If you accept the new proposal, $x_{t+1}$ takes that value (you 'move' to the new value); otherwise $x_{t+1}=x_t$ (you "don't move" to the proposed value when you don't accept). If you only list the values you accept without keeping track of how many proposals they are retained for, you'll have the wrong probabilities. $\endgroup$
    – Glen_b
    Commented Nov 8, 2014 at 0:23

1 Answer 1

8
$\begingroup$

The validation of the Metropolis-Hastings algorithm relies on repeating the current value in the Markov chain if the proposed value is rejected. You should not consider the list of accepted points as your sample but instead the Markov chain with transition \begin{align*} X_{t+1} &= Y_{t+1} \quad&\text{if } U_{t+1}\le \pi(Y_{t+1})/\pi(X_t)\\ &= X_t \quad&\text{otherwise} \end{align*} (assuming a symmetric proposal distribution). The repetition of the current value in the event of a rejection is what makes the algorithm valid, i.e., why $\pi$ is the stationary distribution.

It is always possible to study the distribution of the accepted and of the rejected values, with some recycling possible by Rao-Blackwellisation, but this study is more advanced and far from necessary to understand the algorithm.

$\endgroup$
2
  • $\begingroup$ Thank you guys very much! I need a little while to work through the links given in the comments - will mark the answer as accepted by tomorrow! $\endgroup$ Commented Nov 7, 2014 at 22:16
  • 2
    $\begingroup$ Alright, got it now. If the proposal $Y_{t+1}$ has been rejected, I will repeat the last accepted value $X_t$ and add it to my list again. If I didn't, that would lead to a wrong stationary distribution and therefore wrong inferences. Thank you @Xi'an and everyone else, also for the very helpful links! $\endgroup$ Commented Nov 8, 2014 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.