We can also analyze this model using a Bayesian MCMC framework. We can modify the standard approach to Bayesian MCMC (see chapter 2):
- Sample a starting parameter value, q, from its prior distributions. For this example, we can set our prior distribution as uniform between 0 and 1. (Note that one could also treat probabilities of states at the root as a parameter to be estimated from the data; in this case we will assign equal probabilities to each state).
- Given the current parameter value, select new proposed parameter values using the proposal density Q(q′|q). For example, we might use a uniform proposal density with width 0.2, so that Q(q′|q) U(q − 0.1, q + 0.1).
- Calculate three ratios:
- a. The prior odds ratio, Rprior. In this case, since our prior is uniform, Rprior = 1.
- b. The proposal density ratio, Rproposal. In this case our proposal density is symmetrical, so Rproposal = 1.
- c. The likelihood ratio, Rlikelihood. We can calculate the likelihoods using Felsenstein’s pruning algorithm (Box 8.1); then calculate this value based on equation 2.26.
- Find Raccept as the product of the prior odds, proposal density ratio, and the likelihood ratio. In this case, both the prior odds and proposal density ratios are 1, so Raccept = Rlikelihood
- Draw a random number u from a uniform distribution between 0 and 1. If u < Raccept, accept the proposed value of both parameters; otherwise reject, and retain the current value of the two parameters.
- Repeat steps 2-5 a large number of times.
We can run this analysis on our squamate data, obtaining a posterior with a mean estimate of q = 0.001980785 and a 95% credible interval of 0.001174813 − 0.003012715.