Problem 1. Let X1, X2, · · · , X6 be a sequence of independent, identically distributed Bernoulli random variables with parameter θ, and suppose we observe x1 = x2 = x3 = x4 = x5 = 1 and x6 = 0. Derive the posterior probabilities for Model 0 (M0): θ = 12 and Model 1 (M1): θ > 12, assuming the following prior distributions:
(a) P(M0) = 0.5, P(M1) = 0.5, π1(θ) = 2; θ ∈ (12,1).
(b) P(M0) = 0.8, P(M1) = 0.2, π1(θ) = 8(1−θ); θ ∈ (12,1).
(c) P(M0) = 0.2, P(M1) = 0.8, π(θ) = 48(θ − 12)(1 − θ); θ ∈ (12,1).
In addition, compute the Bayes factor of Model 0 versus Model 1 in (a)-(c).
[Remark: Use paper and pencil to solve this problem, write down the detailed calculation process.]
Problem 2. Write your OWN code to simulate 100 samples from
(a) Exponential distribution: Exp(λ) with λ = 2.8.
(b) Normal distribution using BOTH Box-Muller transformation AND central limit theorem: N(μ,σ2) with (a) (μ, σ2) = (0, 1) and (b) (μ, σ2) = (3.5, 2).
(c) Log-normal distribution LN(μ,σ2) with (a) (μ,σ2) = (0,1) and (b) (μ,σ2) = (−4,2).
(d) Binomial Distribution: Binomial(n, p) with n = 10, p = 0.24.
In each case, plot the density of sample sets to illustrate (validate) your simulated samples.
For part (b), read the attached slides to learn the two methods.
[Remark: Use a computer to simulate those data; explain your code and results carefully] Problem 3. Write a computing code and use the rejection sampling method to simulate a set of 150
samples from the following distribution with density
1 φ(x)1 − sin(20x)/4, if |x| < 3
f(x) = c
0, if |x| > 3.
where φ(x) is the density function of standard normal distribution N(0,1) and c = 3 φ(x)1 − sin(20x)/4dx. Draw the density of those 150 samples.
−3
[Remark: Use a computer to simulate those data; explain your code and results carefully]
1



