. This exercise focuses on the rejection algorithm for simulating from the posterior distribution of mutation rate and coalescence times described at the end of Section XXXXXXXXXXIt builds on the...



.
This exercise focuses on the rejection algorithm for simulating


from the posterior distribution of mutation rate and coalescence times described


at the end of Section 13.8.4. It builds on the method developed in


S. For definiteness, assume that π(θ) is a uniform density over some


range, so prior observations for θ can be generated using runif.


a. Implement the rejection algorithm in R.


b. The quantity h in Step 2 of the rejection algorithm can be replaced by


h =


e−θL/2(θL/2)k/k!


e−kkk/k!


= ek−θL/2(θL/2k)k,


resulting in a faster algorithm. Verify this by modifying your function in


a.


c. Given that k = 5, generate 1000 observations from the posterior distribution


of θ for samples of size n = 10, and plot the estimated posterior


density. The function density is useful for this. Explore the effects of


different prior distributions on the posterior.


d. How could you use the algorithm to generate observations from the posterior


distribution of the time to the most recent common ancestor?



May 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here