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