Pre-required Knowledge
-
Bayes' Rule:
p(π∣D)=p(D)p(D∣π)p(π)
where:
- p(π∣D) is the posterior distribution.
- p(D∣π) is the likelihood.
- p(π) is the prior.
- p(D)=∫p(D∣π)p(π)dπ is the evidence (normalizing constant).
-
Uniform Prior: A uniform prior over π∈[0,1] implies p(π)=1 for 0≤π≤1.
-
Beta Function Identity: As given in Eq. (3.32):
∫01πm(1−π)ndπ=(m+n+1)!m!n!
Step-by-Step Proof
-
Formulate the Posterior:
Using Bayes' rule:
p(π∣D)=∫01p(D∣π′)p(π′)dπ′p(D∣π)p(π)
-
Substitute Likelihood and Prior:
From part (a), likelihood p(D∣π)=πs(1−π)n−s.
Given uniform prior, p(π)=1.
The numerator is:
p(D∣π)p(π)=πs(1−π)n−s⋅1=πs(1−π)n−s
-
Calculate the Evidence (Denominator):
Let Z=p(D)=∫01πs(1−π)n−sdπ.
We use the identity (3.32) with m=s and the exponent of (1−π) being n−s. Note that in the identity n represents the exponent, so we replace the identity's "n" with our "n−s".
Using identity: ∫01πm(1−π)kdπ=(m+k+1)!m!k!.
Here, m=s and k=n−s.
Z=∫01πs(1−π)n−sdπ=(s+(n−s)+1)!s!(n−s)!=(n+1)!s!(n−s)!
-
Compute the Posterior:
Divide the numerator by the denominator Z.
p(π∣D)=Zπs(1−π)n−s=(n+1)!s!(n−s)!πs(1−π)n−s
p(π∣D)=s!(n−s)!(n+1)!πs(1−π)n−s
This matches Eq. (3.33).
Plot for n=1
For n=1, the possible values for s are s=0 or s=1.
-
Case s=1 (One Success):
p(π∣D)=1!(1−1)!(1+1)!π1(1−π)1−1=1⋅12π(1)=2π
This is a linear function increasing from 0 to 2.
-
Case s=0 (One Failure):
p(π∣D)=0!(1−0)!(1+1)!π0(1−π)1−0=1⋅12(1)(1−π)=2(1−π)
This is a linear function decreasing from 2 to 0.
(Self-check: Integral of 2π from 0 to 1 is [π2]01=1. Integral of 2(1−π) is −[(1−π)2]01=−[0−1]=1. Both are valid PDFs.)
Plot description:
- For s=1: A straight line starting at (0,0) and going to (1,2). It favors higher values of π.
- For s=0: A straight line starting at (0,2) and going to (1,0). It favors lower values of π.