Homework question:
Consider the 1-d Ising model.
Let $x = (x_1,...x_d)$. $x_i$ is either -1 or +1
$\pi(x) \propto e^{\sum_{i=1}^{39}x_ix_{i+1}}$
Design a gibbs sampling algorithm to generate samples approximately from target distribution $\pi(x)$.
My attempt:
Randomly choose values (either -1 or 1) to fill vector $x = (x_1,...x_{40})$. So maybe $x = (-1, -1, 1, 1, 1, -1, 1, 1,...,1)$. So this is $x^0$.
So now we need to move on and do the first iteration. We have to draw the 40 different x's for $x^1$ separately. So...
Draw $x_1^1$ from $\pi(x_1 | x_2^0,...,x_{40}^0)$
Draw $x_2^1$ from $\pi(x_2 | x_1^1, x_3^0,...,x_{40}^0)$
Draw $x_3^1$ from $\pi(x_3 | x_1^1, x_2^1, x_4^0,...,x_{40}^0)$
Etc..
So the part that's tripping me up is how do we actually draw from the conditional distribution. How does $\pi(x) \propto e^{\sum_{i=1}^{39}x_ix_{i+1}}$ come into play? Maybe an example of one draw would clear things up.