ptmc
is an R package designed to perform Bayesian inference using a Parallel Tempering Markov Chain Monte Carlo (PT-MCMC) algorithm. This implementation allows efficient exploration of discrete parameter spaces, making it especially useful for models where standard MCMC techniques struggle with multimodal posteriors or slow convergence. This implementation is a generalised version of the algorithm outlined by Miasojedow et al. 2012.
Standard MCMC techniques can become inefficient when dealing with posterior distributions that:
Parallel tempering mitigates these challenges by running multiple chains at different “temperatures.” High-temperature chains explore the parameter space more broadly, while low-temperature chains focus on precise posterior estimation. Occasional exchanges between chains help the algorithm escape local optima and improve convergence.
To install the ptmc
package, follow these steps:
Make sure you have R installed on your system. You can download R from https://cran.r-project.org/.
ptmc
from GitHub
You can install the development version of ptmc
from GitHub using the devtools
package. If you don’t already have devtools
installed, you can install it with:
install.packages("devtools")
devtools::install_github("dchodge/ptmc")
ptmc
from GitHub
After installation, you can load the serojump package into your R session with:
library(ptmc)
See background/ptmc.pdf.
We offer several examples of how to implement this package.
We welcome contributions and suggestions! If you’d like to contribute to the ptmc
package or report issues, please feel free to:
If you have any questions or feedback, or would like more informative vignettes, you can contact the package maintainer at:
David Hodgson Email: david.hodgson@lshtm.ac.uk