Using Metropolis-Hastings algorithm

1k Views Asked by At

I am trying some exercises from my textbook regarding MCMC and I am having trouble using Metropolis-Hastings algorithm.

If I am trying to sample from a binomial distribution with parameters n and p using a proposal uniform distribution on $\{0,1,...,n\}$

I understand how the Metropolis-Hastings work but I'm having a hard time trying to set up a transition matrix for this binomial distribution.

Since the stationary distribution of the sample $\pi$ would be uniformly distributed, then

\begin{align} a(i,j)=\frac{T_{ji}}{T_{ij}} \end{align}

How can I find each $T_{ji}$? I think that I should be using the pmf of the binomial distribution: $\binom{n}{i}p^i(1-p)^{n-i}$ but I'm not quite sure how to reason this out.

Any help or tips would be greatly appreciated!

1

There are 1 best solutions below

1
On BEST ANSWER

I will use the notation from wikipedia.

$A(x'\mid x),$ the Metropolis acceptance probability for transitioning from state $x$ to $x',$ is given by $$ A(x'\mid x)= \min\left(\frac{P(x')g(x\mid x')}{P(x)g(x'\mid x)},1\right)$$ where $P(x)$ is the desired distribution and $g(x'\mid x)$ is your probability of proposing $x'$ when the current state is $x.$ You have chosen a $g$ (the uniform distribution) that is symmetric in $x$ and $x',$ so it cancels out and we have $$ A(x'\mid x)= \min\left(\frac{P(x')}{P(x)},1\right).$$

For the binomial $(n,p)$ distribution we have $$ P(x) = {n\choose x}p^x(1-p)^{n-x}$$ so we have an acceptance threshold of $$ \frac{P(x')}{P(x)} = \frac{{n\choose x'}p^{x'}(1-p)^{n-x'}}{{n\choose x}p^x(1-p)^{n-x}}= \frac{(x')!(n-x')!}{x!(n-x)!}\left(\frac{p}{1-p}\right)^{x'-x}$$