STAT 404 Fall 2022 Assignment One
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
STAT 404 Fall 2022 Assignment One
1. (50 points) Ch. 13 Exercises : (a) #3.1
(b) #3.2
(c) #3.4
(d) #3.7
(e) #3.10 (a)
2. (30 points) Suppose that X and Y have joint p.m.f.
x |
y |
P (X = x, Y |
= |
y) |
0 |
0 |
0.15 |
||
1 |
0 |
0.15 |
||
2 |
0 |
0.15 |
||
0 |
1 |
0.15 |
||
1 |
1 |
0.20 |
||
2 |
1 |
0.20 |
(a) Generate n = 104 random variables Y1, . . . , Yn using a rejection sampling. You can use a Bernoulli distribution with parameter 1/2 as a candidate (proposal) distribution. Provide the (empirical) marginal p.m.f. of Y based on your random numbers and compare it with the (exact) marginal p.m.f. of Y .
(b) Generate n = 104 pairs of random variables {(Xi, Yi)}n using a method of
composition with P (X = x Y = y) and P (Y = y). Provide your estimates
of P (X = x), x = 0, 1, 2 (the empirical marginal p.m.f. of X based on your random numbers) and compare them with the exact values of P (X = x) (the exact marginal p.m.f. of X).
(c) Generate n = 104 pairs of random variables {(Xi, Yi)}n using a Gibbs sampler.
Provide your estimates of P (X = x, Y = y), P (X = x), and P (Y = y), x = 0, 1, 2
and y = 0, 1 and compare them with the exact values.
3. (20 points) Let X1, ..., Xn|θ ∼ Bernoulli(θ), and assume that you have obtained a
sample with x = Σn xi = 710 successes in n = 1000 trials. Suppose that the value
of θ is unknown, and two statisticians A and B assign to θ the following different prior p.d.f.’s pA(θ) and pB(θ), respectively:
pA(θ) = 2θ, for 0 < θ < 1, pB(θ) = 3θ2, for 0 < θ < 1.
(a) Find the posterior distribution that each statistician assigns to θ.
(b) Compute the posterior probability that θ is less than 0.4, P (θ < 0.4|x1, . . . , xn)
based on the prior p.d.f. pA(θ) using ○1 a grid approximation and ○2 a Monte
Carlo method, and compare your answer with the exact value using pbeta().
(c) Compute the posterior distribution of the log-odds ϕ = log θ based on the prior
p.d.f. pB
(θ) using a Monte Carlo method.
1−θ
(d) Find the Bayes estimate for each statistician based on the following error loss function
L(θ, a) =
(θ − a)2, for θ ≤ a,
2(θ − a)2, for θ > a
and check whether the Bayes estimates for the two statisticians are different or not, analytically or numerically.
(e) Suppose that two statisticians are to observe a future binomial value x˜ assumed to have a binomial distribution, X|θ ∼ Binomial(10, θ). Use a Monte Carlo method to compute the posterior predictive variance, Var(X˜|x).
2022-10-17