. Suppose we desire a draw from the marginal distribution of X that is determined by the assumptions that θ ∼ Beta( α, β ) and X | θ ∼ Bin( n, θ ) [96]. a. Show that θ | x ∼ Beta( α + x, β + n − x )....



.
Suppose we desire a draw from the marginal distribution of
X
that is determined by the assumptions that
θ
∼ Beta(α, β) and
X|θ
∼ Bin(n, θ) [96].



a.
Show that
θ|x
∼ Beta(α
+
x, β
+
n

x).



b.
What is the marginal expected value of
X?



c.
Implement a Gibbs sampler to obtain a joint sample of (θ,X), using
x(0) = 0,
α
= 10,
β
= 5, and
n
= 10.



d.
LetU(t+1) and
V(t+1) be independent Unif(0,1) random variables. Then the transition rule from
X(t) =
x(t) to
X(t+1) can be written as
d
(p;μ12) is the inverse cumulative distribution function of the distribution
d
with parameters
μ1 and
μ2, evaluated at
p. Implement the CFTP algorithm from Section 8.5.1, using the transition rule given in (8.50), to draw a perfect sample


for this problem. Decrement
τ
by one unit each time the sample paths do not coalesce by time 0. Run the function 100 times to produce 100 draws from the stationary distribution for
α
= 10,
β
= 5, and
n
= 10. Make a histogram of the 100 starting times (the finishing times are all
t
= 0, by construction). Make a histogram of the 100 realizations of
X(0). Discuss your results.



e.
Run the function from part (d) several times for
α
= 1.001,
β
= 1, and
n
= 10. Pick a run where the chains were required to start at
τ
= −15 or earlier. Graph the sample paths (from each of the 11 starting values) from their starting time to
t
= 0,


connecting sequential states with lines. The goal is to observe the coalescence as in the right panel. Comment on any interesting features of your graph.



f.
Run the algorithm from part (d) several times. For each run, collect a perfect chain of length 20 (i.e., once you have achieved coalescence, don’t stop the algorithm at
t
= 0, but continue the chain from
t
= 0 through
t
= 19). Pick one such chain having
x(0) = 0, and graph its sample path for
t
= 0, . . . ,
19. Next, run the Gibbs sampler from part (c) through
t
= 19 starting with
x(0) = 0. Superimpose the sample path of this chain on your existing graph, using a dashed line.



i.
Is
t
= 2 sufficient burn-in for the Gibbs sampler? Why or why not?



ii.
Of the two chains (CFTP conditional on
x(0) = 0 and Gibbs starting from
x(0) = 0), which should produce subsequent variates
X(t) for
t
= 1,
2, . . .
whose distribution more closely resembles the target? Why does this conditional CFTP chain fail to produce a perfect sample?





May 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here