The Gibbs sampler Suppose f is a function from S d to S. We generate a Markov chain by consecutively drawing from (called the full conditionals). The n’th step of the chain is the whole set of d draws from d different conditional distributions.
A simple Gibbs sampler S={0,1}, d=2. x=(x 0,x 1 ) First component: Second component: Overall:
Is f the stationary distribution? First term in fP is so (the other terms being similar) fP = f.
The path of a Gibbs sampler
The Metropolis algorithm Let Q be a symmetric transition matrix. When in state x, the next state is chosen by the following: 1. Draw y from q x, 2. Calculate r=f(y)/f(x) 3. If r≥1 the next value is y 4. If r<1 go to y with probability r, stay at x with probability 1-r Clearly Markov.
Stationary distribution of Metropolis sampler Let S={0,...,K} and order the states so f(i) ≤ f(j) for i < j. Then p ij = q ij p ji = q ji f(i)/f(j) = q ij f(i)/f(j) = p ij f(i)/f(j) by symmetry of Q Hence f(j)p ji = f(i)p ij so we have detailed balance, and hence the stationary distribution is f.