This question pertains to a specific line written in the book Doing Bayesian Data Analysis by John K. Kruschke.

In section 7.3.1, he applies Metropolis algorithm to a case with: $prior = beta(\theta|1,1), N = 20,$ and $z = 14$. Then he proposes jumps with $normal(0, \sigma)$ where $\sigma$ can be 0.02, 0.2 or 2.

When $\sigma = 0.2$ he writes that jump is between +-0.2 for 68% of the time(which I understand) and proposed jumps are accepted roughly half the time as $N_{acc}/N_{pro} = 0.495$. I do not understand this - how do I get to this result.

  • 3
    $\begingroup$ Are you sure it's not an empirical result? $\endgroup$ – jbowman Oct 25 '18 at 18:11
  • $\begingroup$ @jbowman, I am not sure, he just says, author has not written whether it is empirical or mathematical. $\endgroup$ – Gaurav Singhal Oct 29 '18 at 13:57

Since you do not provide the likelihood, let us assume that $Z|\theta$ is a Binomial $\mathcal{B}(20,\theta)$ variate and its realisation is $z=14$. The posterior distribution on $\theta$ is then a Beta $\mathcal{B}e(15,7)$ [for which MCMC is not required].

If running a Normal random walk proposal for simulating this target, the moves are accepted with probability $$\min\left\{ \dfrac{\pi(\theta')}{\pi(\theta_t)},1\right\}$$ where $\pi(\cdot)$ is the density of the Beta $\mathcal{B}e(15,7)$. This means running a code like

for (t in 2:T){
  if ((prop<0)|(prop>1)|(runif(1)>dbeta(prop,15,7)/dbeta(p[t-1],15,7)))

which returns 0.4862 in my case

  • $\begingroup$ Thanks for the answer, as mentioned in the title it is "Bernoulli Likelihood". I do understand the empirical result, waiting if someone can prove theoretically. $\endgroup$ – Gaurav Singhal Oct 29 '18 at 13:56

Your Answer

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

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