Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Bayesian Data Analysis

Assignment 1: Due Week 5, 2023

STAT 8150/7150

Instructions:

1.  This assignment covers materials in Weeks 1-3.

2.  Due on 24th March 2023.   You need to submit your assignment via the iLearn submission link.

3.  Submission of your assessment to the iLearn link implies that you uphold academic integrity.  This is an individual assessment task.  You may discuss this assignment with your fellow students; however, your results and writing up must be your own work.   The iLearn submission link will allow you to submit a maximum of one PDF file.  If you have multiple files, please consolidate them into one file before submission.

4. For answering the questions, please provide sufficient mathematical derivations, R codes and plots when applicable. You are recommended to use Rmarkdown through Rstudio.   Handwritten is acceptable but needs to be neat,  easily readable,  and included in one pdf submission.

5. A cover page is not required.  However, the document must have your name and student ID on the file.

1.  Question 1 (18 marks)

PART 1. Suppose two people, Benoit and Houying, have different prior beliefs about the average number of ER (emergency room) visits during the 10 pm - 11 pm time period. Benoit’s prior information is matched to a Gamma distribution with parameters α = 70 and β = 10, and Houying’s beliefs are matched to a Gamma distribution with α = 33.3 and β = 3.3.  Let λ be the average number of visits to ER during the particular hour in the evening.

(a) (2 marks) Provide a plot representing two Gamma priors.

(b) (2 marks) Compare the priors of Benoit and Houying with respect to the average

value and spread. Which person believes that there will be more ER visits, on aver- age?  Which person is more confident of his/her best guess” at the average number of ER visits? Provide your reasoning.

(c) (2 marks) Construct 90% interval estimates for λ using Benoit’s prior and Houying’s prior.

(d) (2 marks) After some thought, Benoit believes that his best prior guess at λ is correct, but he is less confident in this guess.  Explain how Benoit can adjust the parameters of his Gamma prior to reflect this new prior belief.

(e) (2 marks) Houying also revisits her prior. Her best guess at the average number of

ER visits is now 3 larger than her previous best guess, but the degree of confidence in this guess hasn’t changed. Explain how Houying can adjust the parameters of her Gamma prior to reflect this new prior belief.

PART 2.  A hospital collects the number of patients in the emergency room admitted between 10 pm and 11 pm for each day of a week.  The following table records the day and the number of ER visits for the given day.

Day Number of ER visits

Sunday

8

Monday

6

Tuesday

6

Wednesday

9

Thursday

8

Friday

9

Saturday

7

Suppose one assumes Poisson sampling for the counts and a conjugate Gamma prior with parameters α = 70 and β = 10 for the Poisson rate parameter λ .

(f) (4 marks) Given the sample shown in the Table, obtain the posterior distribution for λ

through the Gamma-Poisson conjugacy. Obtain a 95% posterior credible interval for λ .

(g) (2 marks) Suppose a hospital administrator states that the average number of ER visits

during any evening hour does not exceed 6. By computing a posterior probability, evaluate the validity of the administrator’s statement.

(h) (2 marks) The hospital is interested in predicting the number of ER visits between 10pm

and  11pm for another week.   Use simulations to generate posterior predictions of the number of ER visits for another week (seven days).

2.  Question 2 (22 marks)

PART 1.  The Exponential distribution is often used as a model to describe the time between events, such as traffic accidents. A random variable Y has an Exponential distri- bution if its pdf is as follows.

f(y | λ) =

if y 0

if y < 0

Here, the parameter λ > 0, considered as the rate of event occurrences.  This is a one- parameter model.

(a) (4 marks) Use the prior distribution λ ∼ Gamma(a,b), and find its posterior dis- tribution π (λ | y1 , ··· ,yn), where yi  i. .  Exponential(λ) for i = 1, ··· ,n.  Do you recognise a known distribution? Is the Gamma prior a conjugate prior for this model?

(b) (3 marks) Define the Jeffreys prior for the parameter λ . Is it proper or improper prior?  (Justify your claim)

(c) (3 marks) Suppose 10 times between traffic accidents are collected:  1.5, 15, 60.3, 30.5,  2.8,  56.4,  27,  6.4,  110.7,  25.4  (in minutes).   With the posterior distribution derived in part (a), use Monte Carlo approximation to calculate the posterior mean, median, and middle 95% credible interval for the rate λ .

(d) (2 marks) Use Monte Carlo approximation to generate another set of 10 predicted times between events.

PART 2. The Weibull distribution is often used as a model for survival times in biomed- ical, demographic, and engineering analyses.  A random variable Y has a Weibull distri- bution if its pdf is as follows.

f(y | α,λ) = λαyα 1 exp(−λyα )     for y > 0.

Here, α > 0 and λ > 0 are parameters of the distribution. For this problem, assume that α = α0  is known, but λ is not known, i.e.  a simplified case of a one-parameter model. Also, assume that software routines for simulating from Weibull distributions are available (e.g., rweibull())

(e) (3 marks) Assuming  a  prior  distribution π (λ | α = α0 )  ∝ 1,  find  its  posterior π (λ | y1 , . . . ,yn,α = α0 ), where yi  i. .  Weibull (λ,α = α0 ) for i = 1, ··· ,n.  Write the name of the distribution and expressions for its parameter values.

(f) (5 marks) Using the posterior distribution derived in part (e), explain step-by-step

how you would use Monte Carlo simulation to approximate the posterior median survival time, assuming that α = α0 . Write also a pseudo-code in R.

(g) (2 marks) What family of distributions represents the conjugate prior distributions

for λ, assuming that α = α0 .