Description
1. Bayes Network.
Incidences of diseases A and B (DA, DB) depend on the exposure (E).
Disease A is additionally influenced by risk factors (R). Both diseases lead to symptoms (S).
Results of the test for disease A (TA) are affected also by disease B. Positive test will be
denoted as TA = 1, negative as TA = 0. The Bayes Network is shown in Figure 1. Needed
conditional probabilities are shown in Table 1.
E R
DB DA
S TA
Figure 1: The DAG of the Bayesian networks
Table 1: The known (or elicited) conditional probabilities
E 0 1
0.8 0.2
R 0 1
0.7 0.3
DA 0 1
E
cRc 0.9 0.1
E
cR 0.4 0.6
ERc 0.5 0.5
ER 0.3 0.7
DB 0 1
E
c 0.8 0.2
E 0.3 0.7
S 0 1
Dc
ADc
B 0.95 0.05
Dc
ADB 0.6 0.4
DADc
B 0.4 0.6
DADB 0.1 0.9
TA 0 1
Dc
ADc
B 0.92 0.08
Dc
ADB 0.8 0.2
DADc
B 0.15 0.85
DADB 0.03 0.97
(a) What is the probability of disease A (DA = 1), if disease B is not present (DB = 0),
but symptoms are present (S = 1).
(b) What is the probability of exposure (E = 1), if symptoms are present (S = 1) and
test is positive (TA = 1).
Hint: You can solve this problem by any of the 3 ways: (i) use of WinBUGS or Open2
BUGS, (ii) direct simulation using Octave/MATLAB, R, or Python, and (iii) exact calculation.
2. Times to Failure.
Three devices are monitored until failure. The observed lifetimes
are 0.9, 1.8, and 0.3 years. If the lifetimes ate modeled as exponential distribution with rate
λ,
Ti ∼ Exp(λ), f(t|λ) = λe−λt, t > 0, λ > 0.
Assume exponential prior on λ,
λ ∼ Exp(2), π(λ) = 2e
−2λ
, λ > 0.
(a) Find the posterior distribution of λ.
(b) Find the Bayes estimator for λ.
(c) Find the MAP estimator for λ.
(d) Numerically find 95% equitailed confidence interval for λ.
(e) Find the posterior probability of hypothesis H0 : λ ≤ 1/2.
3. Gibbs and High/Low Protein Diet in Rats.
Armitage and Berry (1994, p. 111)
report data on the weight gain of 19 female rats between 28 and 84 days after birth. The
rats were placed on diets with high (12 animals) and low (7 animals) protein content.
High protein Low protein
134 70
146 118
104 101
119 85
124 107
161 132
107 94
83
113
129
97
123
We want to test the hypothesis on dietary effect. Did a low protein diet result in significantly lower weight gain?
The classical t test against one sided alternative will be significant. We will do the test
Bayesian way using Gibbs sampler.
Assume that high-protein diet measurements y1i
, i = 1, . . . , 12 are coming from normal
distribution N (θ1, 1/τ1), where τ1 is precision parameter,
f(y1i
|θ1, τ1) ∝ τ
1/2
1
exp
−
τ1
2
(y1i − θ1)
2
, i = 1, . . . , 12.
Low-protein diet measurements y2i
, i = 1, . . . , 7 are coming from normal distribution
N (θ2, 1/τ2),
f(y2i
|θ2, τ2) ∝ τ
1/2
2
exp
−
τ2
2
(y2i − θ2)
2
, i = 1, . . . , 7.
Assume that θ1 and θ2 have normal priors N (θ10, 1/τ10) and N (θ20, 1/τ20), respectively. Take
prior means as θ10 = θ20 = 110 (apriori no preference) and precisions as τ10 = τ20 = 1/100.
Assume that τ1 and τ2 have the gamma Ga(a1, b2) and Ga(a2, b2) priors with shapes
a1 = a2 = 0.01 and rates b1 = b2 = 4.
(a) Construct Gibbs sampler that will sample θ1, τ1, θ2, and τ2 from their posteriors.
(b) Find sample differences θ1 − θ2 . Proportion of positive differences approximates
posterior probability of hypothesis H0 : θ1 > θ2. What is this proportion?
(c) Using sample quantiles find the 95% equitailed credible set for θ1 − θ2. Does this set
contain 0?