Repository for a workshop on Bayesian statistics
"""This file contains code used in "Think Stats",1by Allen B. Downey, available from greenteapress.com23Copyright 2013 Allen B. Downey4License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html5"""67from __future__ import print_function, division89import thinkbayes10import thinkplot111213"""This file contains a partial solution to a problem from14MacKay, "Information Theory, Inference, and Learning Algorithms."1516Exercise 3.15 (page 50): A statistical statement appeared in17"The Guardian" on Friday January 4, 2002:1819When spun on edge 250 times, a Belgian one-euro coin came20up heads 140 times and tails 110. 'It looks very suspicious21to me,' said Barry Blight, a statistics lecturer at the London22School of Economics. 'If the coin weere unbiased, the chance of23getting a result as extreme as that would be less than 7%.'2425MacKay asks, "But do these data give evidence that the coin is biased26rather than fair?"2728"""2930class Euro(thinkbayes.Suite):3132def Likelihood(self, data, hypo):33"""Computes the likelihood of the data under the hypothesis.3435hypo: integer value of x, the probability of heads (0-100)36data: string 'H' or 'T'37"""38# fill this in!39return 1404142def main():43suite = Euro(range(0, 101))4445suite.Update('H')4647thinkplot.Pdf(suite)48thinkplot.Show(xlabel='x',49ylabel='Probability',50legend=False)515253if __name__ == '__main__':54main()555657