Tag Archives: MCMC

MCMC in Python: sampling in parallel with PyMC

Question and answer on Stack Overflow.

Comments Off on MCMC in Python: sampling in parallel with PyMC

Filed under software engineering

MCMC in Python: How to make a custom sampler in PyMC

The PyMC documentation is a little slim on the topic of defining a custom sampler, and I had to figure it out for some DisMod work over the years. Here is a minimal example of how I did it, in answer to a CrossValidated question.

Comments Off on MCMC in Python: How to make a custom sampler in PyMC

Filed under MCMC

MCMC Convergence Diagnostics

I have revisited my approach to deciding if MCMC has run for long enough recently, and I’m collecting some of the relevant material here:

Last time I thought about it: https://healthyalgorithms.com/2010/04/19/practical-mcmc-advice-when-to-stop/

Original paper for R_hat approach: http://www.stat.columbia.edu/~gelman/research/published/itsim.pdf

Presentation comparing several approaches: http://www.people.fas.harvard.edu/~plam/teaching/methods/convergence/convergence_print.pdf

Published comparison: http://www.jstor.org/stable/2291683

Blog about a cool visual approach: http://andrewgelman.com/2009/12/24/visualizations_1/

Discussion on cross-validated: http://stats.stackexchange.com/questions/507/what-is-the-best-method-for-checking-convergence-in-mcmc

Book with a chapter on this referenced there: http://www.amazon.com/dp/1441915753/?tag=stackoverfl08-20 (available as an eBook from UW Library, how convenient!)

Another related blog: http://xianblog.wordpress.com/2012/11/28/mcmc-convergence-assessment/

Comments Off on MCMC Convergence Diagnostics

Filed under statistics

ML in Python: Naive Bayes the hard way

A recent question on the PyMC mailing list inspired me to make a really inefficient version of the Naive Bayes classifier. Enjoy.

Comments Off on ML in Python: Naive Bayes the hard way

Filed under machine learning

Stan in IPython: reproducing 8 schools

Continuing my experiment using Stan in IPython, here is a notebook to do a bit of the eight schools example from the RStan Getting Started Guide.

Comments Off on Stan in IPython: reproducing 8 schools

Filed under software engineering

Stan in IPython: getting starting

There has been a low murmur about new MCMC package bouncing through my email inbox for a while now. Stan, it is. The project has reached the point where the developers are soliciting Python integration volunteers, so I decided it is time to check it out.

Good news, it installed and ran the example without frustration! I don’t take that for granted with research software.

IPython Notebook here.

Comments Off on Stan in IPython: getting starting

Filed under software engineering

MCMC in Python: Bayesian meta-analysis example

In slow progress on my plan to to go through the examples from the OpenBUGS webpage and port them to PyMC, I offer you now Blockers, a random effects meta-analysis of clinical trials.



[py] [pdf]

1 Comment

Filed under MCMC, software engineering