联系方式

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

您当前位置:首页 >> Algorithm 算法作业Algorithm 算法作业

日期:2019-11-21 11:50

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 + x

2)

, 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]


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp