Professional Documents
Culture Documents
Giovanni Romeo
22 September 2016
Exercise 8
A random sample of n students is drawn from a large
population, and their weights are measured. The
average weight of the n sampled students is ȳ = 150
pounds. Assume the weights in the population are
normally distributed with unknown mean θ and
known standard deviation 20 pounds. Suppose your
prior distribution for θ is normal with mean 180 and
standard deviation 40.
I Prior p(θ) = N(µ0 , τ 2 ) = N(180, 402 )
0
I Sampling distribution
0.015
0.05
0.04
0.010
density
density
0.03
0.02
0.005
138.48 162.98 109.67 191.79
0.01
0.000
0.00
140 150 160 170 100 120 140 160 180 200
0.020
0.20
0.015
0.15
density
density
0.010
0.10
0.005
0.05
0.000
0.00
144 146 148 150 152 154 156 100 120 140 160 180 200
Posterior n=100
0.10
density
0.05
Posterior n=10
Prior
0.00
Figure: comparison
Exercise 9
α
E (θ) =
= 0.6 (1)
α+β
αβ
Var (θ) =
= (0.3)2(2)
(α + β) (α + β + 1)
2
Figure: Prior
(b) A random sample of 1000 Californians is taken,
and 65% support the death penalty. What are your
posterior mean and variance for θ? Draw the
posterior density function.
I Posterior distribution
p(θ) = Beta(θ|y + α, n − y + β)
Posterior
20
15
Prior
10
5
0
Figure: Posterior
(c) Examine the sensitivity of the posterior
distribution to dierent prior means and widths
including a non-informative prior.
Exercise 9
Prior Beta(1,1)
25
Posterior
20
15
10
5
Prior
0
Prior Beta(2,8)
25
Posterior
20
15
10
Prior
5
0
Prior Beta(20,80)
25
Posterior
20
15
10
Prior
5
0
Prior Beta(50,200)
Posterior
25
20
Prior
15
10
5
0
I
n
Y (θxi )yi e −θxi
p(y |θ) = =
yi !
i=1
I
n n
Y x yi yi −θxi
Y
= i
θ e ∝ θyi e −θxi
yi !
i=1 i=1
I
Pn Pn
p(y |θ) ∝ θ( i=1 yi ) e −(θ i=1 xi )
Exercise 18
I Posterior distribution p(θ|y ) ∝ p(y |θ)p(θ)
I
(
Pn
i=1 yi ) −(θ
Pn
i=1 xi )
β α α−1 −βθ
p(θ|y ) ∝ θ e θ e
Γ(α)
I
Pn Pn
( i=1 yi ) −(θ i=1 xi ) α−1 −βθ
p(θ|y ) ∝ θ e θ e
I
Pn Pn
p(θ|y ) ∝ θ(α+ i=1 yi −1) e −θ(β+ i=1 xi )
p(θ|y ) ∼ Gamma(αn , βn )
I
n
X n
X
Where αn = α+ yi and βn = β + xi
Exercise 12
Course Notes and Exercises by Nils Lid Hjort
Exercise 12
I Expected Loss
Z
E [L(a|y )] = L(θ, a)p(θ|y )dθ
R 0.15
I E [L(alarm|y )] = 1000 p(θ|y )dθ
0
R1
I E [L(no alarm|y )] = 5000 0.15 p(θ|y )dθ
1
= θy (1 − θ)50−y · [θ1 (1 − θ)7 + θ7 (1 − θ)1 ] =
2
I
1 1
= [θy +2−1 (1−θ)50−y +8−1 ]+ [θy +8−1 (1−θ)50−y +2−1 ]
2 2
I
1 1
p(θ|y ) ∼ Beta(y +2, 50−y +8)+ Beta(y +8, 50−y +
2 2
Exercise 12
R 0.15
I E [L(alarm|y )] = 1000 0p(θ|y )dθ
R1
I E [L(no alarm|y )] = 5000 0.15 p(θ|y )dθ
Uniform prior
5000
● ● ● ●
●
●
No alarm
●
4000
●
3000
Loss Function
●
2000
●
1000
● ● ● ● ●
●
●
●
● ●
●
●
●
Alarm
● ● ●
● ● ● ● ● ● ●
0
0 5 10 15
Beta(2,8) prior
5000
● ● ●
●
●
● No alarm
●
4000
●
3000
●
Loss Function
●
2000
●
1000
● ● ● ● ●
●
●
●
● ●
●
●
● Alarm
● ● ●
● ● ● ● ● ● ●
0
0 5 10 15
● ● ● ●
●
●
● No alarm
●
4000
●
3000
Loss Function
●
2000
●
1000
● ● ● ● ● ● ● ● ●
Alarm
● ● ● ● ● ● ● ●
0
0 5 10 15
Uniform
Beta(2,8)
3.0
Mixture
2.5
2.0
1.5
1.0
0.5
0.0