4
$\begingroup$

I am an IT guy writing my masters thesis on MCMC methods for use in predicting the outcome of football(soccer) matches. Right now I am trying to wrap my head around MCMC and Metropolis-Hastings in particular. Coming from software development I don't really have the understanding of probability and statistics needed. I do understand how and why the acceptance function of Metropolis-Hastings work, but I can't really wrap my head around how to calculate the acceptance probability

$$ min(1, \frac{P(X')}{P(X)} * \frac{Q(X|X')}{Q(X'|X)}) $$

Were $X$ is my previous sample and $X'$ is my randomly generated sample from the proposal distribution $Q$

In trying to understand the algorithm i have created the toy problem where my goal is to estimate a target density $P(X) \sim N(0,1)$, using the proposal distribution $Q(X) \sim N(.,0.25)$

I know this must seem like a really stupid question, but do you actually evaluate the density in $X$ for $P(X)$, and how do you calculate the transition probability $Q(X|X')$?

I know this is stupid since $Q$ is symmetric and would cancel out the transition probability (and that this can be done using the Metropolis algorithm), but I need to know how to calculate it correctly. Thanks!

1 Answers 1

3

In your example, the $Q$ terms do not cancel out because you are drawing from the independent metropolis algorithm. It would cancel if it is for instance random walk metropolis algorithm.

Let $\phi_s(x)$ be the density of a normal distribution with variance 1 evaluated at point $x$. At step $n$ in the algorithm, you draw from your proposal $N(.,0.25)$ a new element. Let us call it $x'$. Let $x_n$ be the draw from the previous step. Now you have to decide whether to accept $x'$ and set $x_{n+1}=x'$ or not. To do that compute the ratio $$ \frac{\phi_1(x') \phi_{0.25}(x_n)}{\phi_1(x_n) \phi_{0.25}(x')}$$. If it is bigger than 1, just put 1 as the ratio. Now, that ratio is the uniform acceptance probability of the new draw. So draw a uniform random variable from $U(0,1)$ to decide that.

Please notice that in your example, it is called the independent metropolis algorithm because the $Q$'s do not involve conditioning on the previous draws.

  • 0
    Thanks for your reply! However, I forgot to mention that $Q \sim N(X, 0.25)$ So my draw from Q is indeed conditioned on the previous sample.2012-11-25
  • 0
    In that case, it is the random walk metropolis. Replace the ratio by $\phi_1(x')/\phi_1(x_n)$. The thing that cancels is $\phi_{0.25}(x_n-x')/\phi_{0.25}(x_n-x') = 1$2012-11-25
  • 0
    Thank you! So $\phi_{0.25}(x_n|x') = \phi_{0.25}(x_n - x')$?2012-11-25
  • 0
    Yes, just a look a the formula for the normal density. Here $x'$ would be the mean.2012-11-25
  • 0
    Let $\phi_{m,s}$ be the density of a normal distribution with mean $m$ and variance $s$. Check the identity $\phi_{m,s}(x)=\phi_{0,s}(x-m)$2012-11-25
  • 0
    Ahh, thanks so much for your time and effort :)2012-11-25