# STAT40410作业代做、代写UCD Monte Carlo作业、代做R课程设计作业、R编程设计作业调试帮做C/C++编程|帮做Java程序

UCD Monte Carlo inference - STAT40410
2019-2020 Nial Friel
Assignment 4
Hand-in date: Monday 25th of November, 12pm
1) You are hired as a statistician to investigate absenteism in a company. You believe that absenses
follow a Poisson(λ) distribution and, before seeing any evidence, you are 75% sure that the value
of λ is less than 5 and decide to use an exponential distribution as your prior for λ. You take a
random sample of 50 students and find out the number of absences that each has had over the
past semester. You discover that HR has only recorded the precise number of absences for any
employee if they have had 2 or more absences in the past 12 months. Therefore the data do
not discriminate between those who have had 0 absences and those who have had 1 absence.
The data that you are provided with are summarised below.
Number of absences ≤ 1 2 3 4 5 6 7 8 9 10
Frequency 18 13 8 3 4 3 0 0 0 1
(a) Derive carefully an algorithm to estimate the posterior distribution of λ. [10]
(b) Similarly, explain how one might explore the posterior distribution of z, the number of
employees out of the sample of 50 who had no absences during the previous 12 months.
[10]
(c) Write R code to implement this algorithm. [20]
(d) Provide suitable summaries (posterior means and variances, credible intervals, probability
densities etc.) to communicate your conclusions regarding λ and z. [20]
2) Consider again, the example which we have examined recently in lectures. Namely, to estimate
the probability P(X > 2) where X follows a Cauchy distribution with density
f(x) = 1π(1 + x2), x ∈ R.
(a) Implement an algorithm in R to estimate this probability using control variates. (You can
use the same approach developed in the lectures). [20]
(b) Similarly, implement an algorithm in R to estimate this probability using importance sampling
(without employing control variates). (Again, using the same approach in lectures).
[10]
(c) Compare the estimated variance resulting from the estimators in 1. and 2. above. [10]

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp2