0
$\begingroup$

I am trying to use the Metropolis-Hasting in order to obtain a sample for X that is a vector of length N of values that go from 0 to K (in this case K=3). So X ~ Binom(K, p) and p ~ Beta(1,1).

For specific reasons I need to use the Metropolis-Hastings, and I can't use the conjugacy. I though about a possible distribution to sample from for the proposal but it is working and I am trying to understand why. I would propose a new value from a Binomial(K, x_current/K). The problem here is that whenever the initial value is 0 or K I get to be stuck because I would sample K with probability K/K = 1 and the same goes for the 0. How can I solve this problem? Thanks in advance!

N <- 20 
K <- 3
pi <- c(0.15, 0.11, 0.12, 0.04, 0.3, 0.35, 0.44, 0.23, 0.55, 0.59, 0.66, 0.73, 0.57, 0.64, 0.70, 0.68, 0.88, 0.90, 0.95, 0.83)
x <- matrix(NA, N, sims)
x[,1] <- c(0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3)
outcome <- matrix(NA, N, sims)

for (t in 2:sims) {
  x_cur <- x[,t-1]
  for (i in 1:N) {
    x_prop <- rbinom(1, K, x_cur[i]/K)
    ...
  }
} 
```
$\endgroup$
4
  • $\begingroup$ Just change the proposal at the boundaries, i.e. when $x_t=0,K$. Else, use a proposal like a Binomial$$\mathcal B\left(K,\frac{x_t+1}{K+2}\right)$$ to avoid the point mass proposals at $0$ and $K$. $\endgroup$
    – Xi'an
    Apr 3 at 6:42
  • $\begingroup$ By saying that it gets stuck I mean that it does not mix well the possible values because there is so much probability around 0 and K anyway. Even changing the proposal as you proposed. What other distribution can be considered otherwise? $\endgroup$
    – Bibi
    Apr 3 at 7:34
  • $\begingroup$ I have also thought about using a BetaBinomial, but I still get the same problem. Would it be easier to find a solution with the BetaBinomial instead of the Binomial? $\endgroup$
    – Bibi
    Apr 3 at 9:04
  • $\begingroup$ You can push the proposal towards the centre as much as you wish when using $(x_t+\kappa)/(K+2\kappa)$ and increasing $\kappa$ until you get a better mixing rate. $\endgroup$
    – Xi'an
    Apr 3 at 13:29

0

Your Answer

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