<p>In short, the posterior is a probability value between 0 and 1 which is calculated from <a href="https://en.m.wikipedia.org/wiki/Bayes%27_theorem" rel="nofollow noreferrer">Bayes rule</a>, which In phylogenetic usage is given as the product of the prior probability and the likelihood divided by a normalising constant. The posterior probability allows you to state the probability of some hypothesis given the data at hand (as opposed to the likelihood parlance, which is probability of data given hypothesis).</p>

<p>In a phylogenetic setting, the sampler works (roughly) like this: propose some value of a parameter (topology, branch lengths, etc.) and use the specified prior and calculated likelihood for that parameter value given the data to calculate the unnormalised posterior. Next, propose a new value, and repeat the same step. Compare the two values, and if the posterior probability of the second is greater, accept this parameter value and repeat the cycle again. In this way the Markov Chain moves through posterior space until it reaches a reasonably stable optimal approximation of the posterior distribution. Here, we want to get as many samples as possible to maximise the accuracy of our posterior. The maximum a posteriori (MAP) value of the parameter and its credible intervals, etc, will come from the distribution of these samples. </p>

CC BY-SA 4.0
2018-07-29T18:39:45.443Z
Thank you so much! This is very clear and helpful. There is just one detail that I am hung up on, namely this step: "use the specified prior and calculated likelihood for that parameter value given the data to calculate the posterior." How can this be calculated without knowing the marginal probability/normalizing constant?
Namenlos
CC BY-SA 4.0
2018-07-30T07:00:56.877Z
@Namenlos this is actually related to a property of the Metropolis-Hastings algorithm: because each step of the chain explores ratios of a value which is proportional to the posterior (that is, the likelihood multiplied by the prior; the numerator of Bayes' rule), the denominator of the posterior cancels out. Samples from the chain therefore give you an estimate of the posterior probability. I've edited my answer to reflect this.
NatWH
CC BY-SA 4.0
2018-07-30T07:05:23.597Z
Extra details can be found in [this](https://www.nature.com/articles/s41559-017-0280-x) excellent introduction to Bayesian phylogenetics
NatWH
CC BY-SA 4.0
2018-07-30T18:03:57.400Z
Ah, I see. Thank you again. This is starting to make sense now.
Namenlos
CC BY-SA 4.0
2018-07-28T12:14:45.893Z
2018-07-30T07:16:30.700Z
2018-07-30T07:16:30.700Z
NatWH
<p>I am new to the world world of Bayesian-MCMC inference and have been working my way through various texts. I am having some difficulty understanding how MCMC works. I understand that it is a way of sampling from the posterior distribution. What is puzzling me, however, is how the probabilities of the posterior distribution have been calculated. That is, if the Markov Chain is sampling from the posterior distribution, that posterior distribution must have probability values on some axis. How were those calculated? </p>

<r><phylogenetics><phylogeny>
A basic question about phylogenetic inference with Bayes-MCMC
# A basic question about phylogenetic inference with Bayes-MCMC

(Asked by: username_0 on 2018-07-27)

I am new to the world world of Bayesian-MCMC inference and have been working my way through various texts. I am having some difficulty understanding how MCMC works. I understand that it is a way of sampling from the posterior distribution. What is puzzling me, however, is how the probabilities of the posterior distribution have been calculated. That is, if the Markov Chain is sampling from the posterior distribution, that posterior distribution must have probability values on some axis. How were those calculated?

**Tags:** r, phylogenetics, phylogeny

---

## 1 answers

### Answer by username_1 on 2018-07-28. Score: 2 | Accepted answer

In short, the posterior is a probability value between 0 and 1 which is calculated from [Bayes rule](https://en.m.wikipedia.org/wiki/Bayes%27_theorem), which In phylogenetic usage is given as the product of the prior probability and the likelihood divided by a normalising constant. The posterior probability allows you to state the probability of some hypothesis given the data at hand (as opposed to the likelihood parlance, which is probability of data given hypothesis).

In a phylogenetic setting, the sampler works (roughly) like this: propose some value of a parameter (topology, branch lengths, etc.) and use the specified prior and calculated likelihood for that parameter value given the data to calculate the unnormalised posterior. Next, propose a new value, and repeat the same step. Compare the two values, and if the posterior probability of the second is greater, accept this parameter value and repeat the cycle again. In this way the Markov Chain moves through posterior space until it reaches a reasonably stable optimal approximation of the posterior distribution. Here, we want to get as many samples as possible to maximise the accuracy of our posterior. The maximum a posteriori (MAP) value of the parameter and its credible intervals, etc, will come from the distribution of these samples.

> **Comments:**
> **username_0**: Thank you so much! This is very clear and helpful. There is just one detail that I am hung up on, namely this step: "use the specified prior and calculated likelihood for that parameter value given the data to calculate the posterior." How can this be calculated without knowing the marginal probability/normalizing constant?  
> **username_1**: @Namenlos this is actually related to a property of the Metropolis-Hastings algorithm: because each step of the chain explores ratios of a value which is proportional to the posterior (that is, the likelihood multiplied by the prior; the numerator of Bayes' rule), the denominator of the posterior cancels out. Samples from the chain therefore give you an estimate of the posterior probability. I've edited my answer to reflect this.  
> **username_1**: Extra details can be found in [this](https://www.nature.com/articles/s41559-017-0280-x) excellent introduction to Bayesian phylogenetics  
> **username_0**: Ah, I see. Thank you again. This is starting to make sense now.  

---

