Professional Documents
Culture Documents
Solutions to worksheet 1
Then, substituting the values into Bayes’ Theorem, we obtain the proba-
bilities,
Route 1 2 3 4
P (r|j) 0.083 0.208 0.333 0.375
1
Moderate Medium High
0.89 0.97 0.99
(c) This exercise can be used to highlight both the benefit of the prior
to incorporate previously known information and the importance of
choosing an appropriate prior. It also highlights the importance of
stratification and repeat testing. Not all results are alike and we will
not have the same “confidence” in them. You might also want to
touch upon how difficult it is to know the real prevalence and hence
the need for hyper-parameters.
√
3. Poisson data with a prior, π(µ) ∝ 1/ µ.
2
5. Extra-variation Poisson prior:
(a) The prior for θ is given by,
Z ∞ Z ∞ θ
λ exp(−λ) β α α−1
π(θ) = π(θ|λ)π(λ)dλ = λ exp(−βλ)dλ
0 0 θ! Γ(α)
Z ∞
βα
= λθ+α−1 exp(−(β + 1)λ)dλ
Γ(α)Γ(θ + 1) 0
Z ∞
βα Γ(θ + α) (β + 1)θ+α θ+α−1
= θ+α
λ exp(−(β + 1)λ)dλ
Γ(α)Γ(θ + 1) (β + 1) 0 Γ(θ + α)
Note that the integrand in the above integral is a Gamma(α + θ, β + 1) pdf.
α θ
Γ(θ + α) β 1
Γ(α)Γ(θ + 1) β + 1 β+1
Thus, comparing this expression with the pdf of a Negative Binomial,
we have that,
θ ∼ Negative Binomial(α, β)
(b) The sampling distribution for x is:
θ!
f (x|θ) = px (1 − p)θ−x .
x!(θ − x)!
Note that as a likelihood function for θ, θ must be greater than or
equal to x, i.e., θ ∈ {x, x + 1, x + 2, · · · }. Then the posterior for θ:
θ
θ! Γ(θ + α) 1
p(θ|x) ∝ (1 − p)θ
(θ − x)! Γ(θ + 1) β + 1
θ
Γ(θ + α)Γ(θ + 1) 1−p
=
Γ(θ − x + 1)Γ(θ + 1) β + 1
θ
Γ(θ + α) 1−p
=
Γ(θ − x + 1) β + 1
for θ = x, x + 1, x + 2, · · · .
Because θ is discrete, the marginal distribution for x can be found
by summing over possible values of θ:
∞ θ
X Γ(θ + α) 1−p
m(x) = .
Γ(θ − x + 1) β + 1
θ=x