For some time I have struggled with understanding MCMC Metropolis-Hasting application. Especially the terms in the acceptance ratio.

I understand this is the correct form \begin{align} \alpha=min\left(\frac{p(\theta')l(y,\theta')q(\theta|\theta')}{p(\theta)l(y,\theta)q(\theta'|\theta)},1\right) \end{align}

Where p - prior distribution

l - likelihood

q - transition distribution

I will add an example where for better explaining my problem. I have some data point I want to fit a binomial distribution to. \begin{align} P(N,k,c) = \binom{N}{k} \cdot c^k(1-c)^{N-k} \end{align} Where N and k is known. Basically I want to draw different sample of c. I know MCMC is a bit overkill.


  1. Set a prior. Can the prior be the binomial distribution? Or can it be a stupid guess, let say $p(\theta)=\theta/30$?

  2. Draw a sample of c from q. How do you calculate the transition? I know a symmetric transition will cancel out, but I want to know for the future.

  3. Is the likelihood \begin{align} l(y,\theta) = P(N,k,c)= \binom{N}{k} \cdot c^k(1-c)^{N-k} \end{align} ?

  4. Calculate $\alpha$, but if the prior is a binomial distribution then $p(\theta')=l(y,\theta)$?

5.accept or reject if $\alpha>$ random number between 0 and 1.

  1. If accepted, will the old prior remain the initial or will it be updated?

If it was a binomial distribution, will it be updated with the new $\theta=c$?

If the prior was $p(\theta)=\theta/30$, will it remain so or become the binomial distribution? Is the initial prior only used in the first step? Or should the new prior be the the proposed distribution q?

  1. Since the gaussian can draw samples $\theta'<0$, can I simply prevent it with some "if" statement?

Sorry if it is hard to understand, but I really struggle to understand, so it is difficult to explain

| cite | improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.