# Sample conditional distribution from a Markov Chain

Suppose I have a Markov chain (initial distribution and transition matrix).

Using this Markov chain I can generate an arbitrary length sequences.

How can I effective sample (other than rejection sampling) on it to satisfy certain properties? For example, I want sample from the conditional distribution:

$$P(X_5,X_6|X_1=1,\cdots,X_4=1,X_7=1,\cdots,X_{10}=1)$$

• Since $(X_t)$ is Markov$$P(X_5,X_6|X_1=1,\cdots,X_4=1,X_7=1,\cdots,X_{10}=1)=P(X_5,X_6|X_4=1,X_7=1)\propto P(X_5|_4=1)P(X_6|X_5)P(X_7=1|X_6)$$ – Xi'an Jul 15 '18 at 18:22

\begin{align} & P(X_5,X_6 | X_1, \cdots, X_4, X_7, \cdots X_{10}) \\ & = P(X_5,X_6 |X_4, X_7) \\ & \propto P(X_5|X_4)P(X_6|X_5)P(X_7|X_6) \end{align}