Here is a Ruby script for calculating the “burn-in” for a Markov Chain Monte Carlo run, using the Mr. Bayes software package. In some circles, “burn-in” is referred to as stationarity.

My script performs the following steps:

- parses the *.p file(s) from a Mr. Bayes mcmc run.
- calculates the average log likelihood for the final 15% of the samples
- starting at the top of the *.p file(s), finds the first sample whose log likelihood value is equal to the value calculated in #2. This sample is where the burnin should be drawn. In other words, this sample is where the MCMC run reached stationarity.

You can download the file below; instructions are in the top of the file.

**DOWNLOAD HERE:** burnin-calc.rb

### Like this:

Like Loading...

*Related*

Tags: Bayesian, burnin, MCMC, MCMCMC, MrBayes

This entry was posted on May 22, 2008 at 1:35 pm and is filed under academia, bioinformatics, phylogenetics, software. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

## Leave a Reply