0

$$p(x) \propto \exp\left(-\frac{x_1^2}{10} - \frac{x_2^2}{10} - 2(x_2 - x_1^2)^2\right),\\ p(y|x) = \mathcal{N}(y; x_2, 0.1)$$

I want to sample from the posterior arising from this likelihood and prior distribution using both the random walk metropolis Hastings algorithm and the Metropolis adjusted Langevin algorithm.

My acceptance probability is given by: $$\alpha(X_{n-1}, X_0) = \min \left(1, \frac{p(X_0)q(X_{n-1}|X_0)}{p(X_{n-1})q(X_0|X_{n-1})}\right) $$

where q is my proposal distribution where I have used a normal distribution.

How can I use this algorithm to sample from the posterior. Do I need to sample from p(x), use that sample to generate a sample of y and then use that combination to determine acceptance of the sample?

John Smith
  • 120
  • 7

0 Answers0