# 8.4: Using Bayesian MCMC to estimate parameters of the Mk model

- Page ID
- 21624

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,
*R*_{prior}. In this case, since our prior is uniform,*R*_{prior}= 1. - b. The proposal density ratio,
*R*_{proposal}. In this case our proposal density is symmetrical, so*R*_{proposal}= 1. - c. The likelihood ratio,
*R*_{likelihood}. We can calculate the likelihoods using Felsenstein’s pruning algorithm (Box 8.1); then calculate this value based on equation 2.26.

- a. The prior odds ratio,
- Find
*R*_{accept}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*R*_{accept}=*R*_{likelihood} - Draw a random number
*u*from a uniform distribution between 0 and 1. If*u*<*R*_{accept}, 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.