Based on http://www.greenteapress.com/thinkbayes/