Lab 29 - MrBayes 3.1.2

Biol 615 Systematics and Comparative Biology, (Sikes)

This lab, and many of the subsequent labs, will not be graded. You can complete this lab at your leisure. MRBayes is a free download and you can install it on any Unix, PC, or Mac computer on which you have permission to do so. The program is available here:

This lab is based, heavily, on labs prepared by two phylo-statisticians who know far more about Bayesian analysis than I do: Paul Lewis and Fredrik Ronquist (these guys really know this stuff - they write the programs - Ronquist is the co-developer of MrBayes).

1. Locate the primates.nex file in the examples folder inside the MrBayes folder

Move the primates.nex file so it is in the same folder as MrBayes3.1.2

MRBayes expects the datafile it analyzes to be in the same folder (directory) as the program. It will also write some results files to this same folder.

You can use your own dataset instead if you prefer but this lab is written to work best with the primate datafile.

2. Work through the tutorial prepared by F. Ronquist

This tutorial was written to use the primates.nex file and covers all the basics of a Bayesian analysis.

Ronquist MrBayes tutorial (pdf file)

Please do this tutorial slowly enough to understand what you are doing. If you skip this step and go straight to the next part of this lab you could end up producing a Bayesian analysis without having a clue as to how it was done or what options you selected and why.

3. Add a MrBayes block to the datafile

Typically we don't type most of the commands at the MrBayes prompt - instead we add a MrBayes block that includes all the commands to create a log file, to set the model, the set the MCMC chain, and to summarize the data when done:

a MrBayes block that you can use with the primates datafile is below - place this below the datamatrix:


log start filename=primates.log.txt;

set autoclose=yes;

lset nst=6 rates=invgamma;


mcmc ngen=25000 samplefreq=100 printfreq=100 nchains=4 savebrlens=yes;

log stop;


This is a small simple dataset - for larger more complex datasets it is best to run the MCMC chain longer (1+ million steps) and to use a larger burnin (up to 20% of the samples).

With this block saved into your file when you execute the file in MrBayes all the commands in the block will be read & executed as well. The commands are explained in the tutorial (except the autoclose=yes command, this tells MrBayes that after it has run the MCMC for the specified number of steps to close the chains without waiting for user input.)

Use sump and sumt with burnin=50 to view the parameter estimates and tree from the run.

Tip: When you have completed a run take all the files produced by MrBayes, including the dataset file and move them into a new folder named something like 'MrB run1'. This way you prevent those files from being overwritten by MrBayes when you next run your dataset. To run your dataset again, copy (don't move) the datafile back into the same folder as MrBayes and repeat. Keeping the datafile in your results folder is a good idea because we often find ourselves modifying our datafiles (adding new species etc) and it can become difficult to determine what datafile was used for what analysis unless you keep them together.

Recall the trees produced by the Parsimony and ML searches we did with this dataset - compare them to the tree produced by MrBayes.

Appendix: BayesPhylogenies

A program for Bayesian inference that can implement a ´mixture model´ (Pagel and Meade, 2004) allowing the user to fit more than one model of sequence evolution, without partitioning the data.

For those interested in Bayesian inference this program is worth investigating. The mixture-model approach is a very powerful method to detect significant partitions in your data.

Pagel, M. and Meade, A. (2004) A phylogenetic mixture model for detecting pattern-heterogeneity in gene sequence or character-state data. Syst Biol 53: 571-581.