Question about Metropolis Hastings algorithm

  • Thread starter pamparana
  • Start date
  • Tags
    Algorithm
In summary, the Metropolis Hastings algorithm is a powerful MCMC algorithm used in Bayesian statistics to generate samples from a desired probability distribution. It works by generating a sequence of random samples and using a proposal distribution to accept or reject new samples. The main difference between the Metropolis and Metropolis Hastings algorithms is that the latter allows for a wider range of proposal distributions. The advantages of using the Metropolis Hastings algorithm include its ability to handle complex distributions, its flexibility in choosing proposal distributions, and its ability to converge to the desired distribution. However, it may be computationally intensive and requires careful tuning, and may not perform well in certain scenarios.
  • #1
pamparana
128
0
Hello everyone,

I am having a bit of trouble understanding the metropolis hastings algorithm which can be used to generate random samples from a distribution that can be difficult to sample directly from:

As I understand it we sample from a proposal distribution (say a normal distribution).

Now, to construct the Markov chain, I sample from this proposal distribution and accept or reject the sample based on the the equation shown http://upload.wikimedia.org/math/3/4/e/34e36a79ed058565327282b6cff8f214.png"

Now, in this equation the first ratio p(x(t))/p(x'). Where is this coming from? It seems that these are the terms from the distribution that we want to directly sample from!? or are they not?

I understand that somehow this will set the Markov chain in a way that the transition probabilities will reflect the desired distribution but I am not sure what this term is how can it be easily calculated.

I would be very grateful for any help you can give me.

Many thanks,

Luca
 
Last edited by a moderator:
Physics news on Phys.org
  • #2


Hello Luca,

I can understand your confusion about the metropolis hastings algorithm. Let me try to break it down for you.

First, let's start with the goal of the algorithm - to generate random samples from a distribution that is difficult to sample from directly. This is often the case with complex distributions in statistics, where it may not be possible to find an analytical solution for sampling.

To do this, we use a proposal distribution, which is a distribution that is easy to sample from. This is where the normal distribution comes in - it is a commonly used proposal distribution because it is easy to sample from and can approximate many other distributions.

Now, let's look at the equation you mentioned: http://upload.wikimedia.org/math/3/4/e/34e36a79ed058565327282b6cff8f214.png" . The first ratio, p(x(t))/p(x'), is the ratio of the probability of the current state (x(t)) to the probability of the proposed state (x'). This is where the desired distribution comes in - p(x(t)) and p(x') are the terms from the distribution we want to sample from.

The second ratio, q(x(t)/x'), is the ratio of the probability of proposing the current state (x(t)) from the proposed state (x'). This is where the proposal distribution comes in - q(x(t)/x') is the probability of sampling x(t) from the proposal distribution given that the proposed state is x'.

Now, the goal of the algorithm is to set up the Markov chain in a way that the transition probabilities reflect the desired distribution. This is done by accepting or rejecting the proposed state based on the ratio of these two probabilities. If the ratio is greater than 1, the proposed state is always accepted. If the ratio is less than 1, the proposed state is accepted with a probability equal to the ratio.

In summary, the first ratio in the equation represents the desired distribution, while the second ratio represents the proposal distribution. By balancing these two ratios, the algorithm is able to generate random samples from the desired distribution.

I hope this helps clarify the metropolis hastings algorithm for you. If you have any further questions, please don't hesitate to ask.


 

1. What is the Metropolis Hastings algorithm?

The Metropolis Hastings algorithm is a Markov Chain Monte Carlo (MCMC) algorithm commonly used in Bayesian statistics to generate samples from a desired probability distribution. It is a powerful computational tool for estimating posterior distributions and performing Bayesian inference.

2. How does the Metropolis Hastings algorithm work?

The Metropolis Hastings algorithm works by generating a sequence of random samples from a given probability distribution. These samples are then used to approximate the desired probability distribution. The algorithm uses a proposal distribution to generate new samples and then accepts or rejects the new sample based on a comparison with the current sample. This process is repeated until a sufficient number of samples are generated.

3. What is the difference between the Metropolis and Metropolis Hastings algorithms?

The Metropolis algorithm is a special case of the Metropolis Hastings algorithm where the proposal distribution is symmetric, meaning the probability of moving from one point to another is the same as moving from the second point to the first. The Metropolis Hastings algorithm allows for a wider range of proposal distributions, making it more flexible and applicable in a variety of scenarios.

4. What are the advantages of using the Metropolis Hastings algorithm?

The Metropolis Hastings algorithm has several advantages, including its ability to handle complex and high-dimensional distributions, its flexibility in choosing proposal distributions, and its ability to converge to the desired distribution even when starting from a poor initial state. It is also relatively easy to implement and can be used for a wide range of statistical problems.

5. What are some potential limitations of the Metropolis Hastings algorithm?

One potential limitation of the Metropolis Hastings algorithm is that it can be computationally intensive, especially for high-dimensional distributions. It also requires careful tuning of the proposal distribution in order to achieve efficient sampling. Additionally, the algorithm may not perform well if the target distribution has multiple modes or if the dimensionality is very high.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
0
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
843
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
21
Views
6K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
923
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
938
Back
Top