, , , , , ,

[SOLVED] Gibbs sampling and metropolis-hastings algorithm math8050: homework 7

$25

File Name: Gibbs_sampling_and_metropolis-hastings_algorithm_math8050:_homework_7.zip
File Size: 649.98 KB

5/5 - (1 vote)

Please load all the packages used in the following R chunk before the function sessionInfo()
# load packages
sessionInfo()
Total points on assignment: 10 (reproducibility) + 45 (Q1) + 45 (Q2)Reproducibility component: 10 points.
1. (45pts in total, equally weighted) Suppose that we want to generate a truncated beta distribution
Beta(2.7, 6.3) restricted to the interval (c, d) with c, d ∈ (0, 1). Assume that c = 0.1 and d = 0.9.
(a) Implement a Metropolis-Hastings algorithm based on a Beta(2, 6) proposal, and provide convergence
diagnostics and acceptance ratio(b) Implement a Metropolis-Hastings algorithm based on a U(c, d) proposal, and provide convergence
diagnostics and acceptance ratio.
(c) Compute P(X > 0.5) using the samples obtained in part (a) and (b).2. (45pts in total, equally weighted) We call X ∼ Tν is a Student’s t random variable with ν degrees of
freedom, that is, its pdf is given by
f(x|ν) = Γ( ν+1
2
)
Γ( ν
2
)
1

νπ 
1 +
x
2
ν
−(ν+1)/2
.Assume that ν = 4. Make sure that you need to perform convergence diagnostics.
(a) Implement a Metropolis-Hastings algorithm with normal distribution N (0, 1) as the proposal distribution.(b) Implement a Metropolis-Hastings algorithm with t distribution T2 as the proposal distribution.
(c) Calculate E(X) and the 95% credible interval for X using the MCMC samplers in part (a) and (b).

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Gibbs sampling and metropolis-hastings algorithm math8050: homework 7
$25