HW2

Dear all,

Let's try to repeat the example in class as a small exercise. Let say we have flip a coin with unknown probability for 10 times and get 4 heads. And let's use a distribution Beta(a=2,b=1) for the prior probability of getting a head.

1. Based on Bayesian estimate, what is the probability of getting a head for the next flip?

2. Now, let say the next flip is indeed a head, what is the probability of getting another head? (Please also use Bayesian estimate.)

3. Can you repeat 1. and 2. with MAP? Hint: you will need to find the peak location of the conditional distribution and you may compute that of a Beta distribution (say with a=5,b=3) using the code below.

N=1000
a=5;b=3
xs=np.linspace(0,1,N)
ps=[stats.beta.pdf(i,a,b) for i in xs]
print ("maximum at " + str(xs[np.argmax(ps)]))

Best,

Sam