BEST代写-线上留学生作业代写 & 论文代写专家

成立于2015年的老牌留学生代写品牌-BEST代写提供超过百门冷热门留学学科的作业和论文代写服务。全网BEST原创,高质,准时的留学生代写。

代码代写|FIT3154 Assignment 2 2022

代码代写|FIT3154 Assignment 2 2022

这是一篇来自澳洲的FIT3154 作业2的代码代写

 

Introduction

There are a total of two questions worth 15 + 21 = 36 marks in this assignment.

This assignment is worth a total of 20% of your fifinal mark, subject to hurdles and any other matters (e.g., late penalties, special consideration, etc.) as specifified in the FIT3154 Unit Guide or elsewhere in the FIT3154 Moodle site (including Faculty of I.T. and Monash University policies).

Students are reminded of the Academic Integrity Awareness Training Tutorial Activity and, in particular, of Monash University’s policies on academic integrity. In submitting this assignment, you acknowledge your awareness of Monash University’s policies on academic integrity and that work is done and submitted in accordance with these policies.

Submission: No fifiles are to be submitted via e-mail. Correct fifiles are to be submitted to Moodle,as given above. You must submit your fifiles in a single ZIP archive. Your ZIP fifile should contain the following:

  1. One PDF fifile containing non-code answers to all the questions that require written answers. This fifile should also include all your plots, and must be clearly written and formatted.
  1. The required R fifiles containing R code answers.

Please read these submission instructions carefully and take care to submit the correct fifiles in the correct places.

Question 1 (15 marks)

In this question we will be looking at the gamma distribution. This is a distribution frequently used in the analysis of non-negative real numbers. This was examined in Assignment 1; the form we use is parameterised in terms of a mean µ and shape φ with probability density

p(y | µ, φ) =1Γ(φ) φµ φ yφ1 exp  φy µ  . (1)

where Γ(·) is known as the “gamma function”. In Assignment 1 we used an inverse gamma prior distribution as this resulted in a simple posterior. This time we will look at using a heavy-tailed half-Cauchy prior distribution with probability density

π(µ | s) =2(1 + µ2/s2). (2)

If a RV X follows a half-Cauchy with scale s, we say X C+(0, s). Our hierarchy is then

yi | µ, φ Ga(µ, φ), i = 1, . . . , n (3)

µ | s C+(0, s)(4)

where s can be thought of as setting the value of the “best guess” of µ before we see the data. For reference, the analysis in Assignment 1 used an inverse gamma prior distribution with hyperparameters a = 17.5 and b = 140250, which encoded a prior best guess for µ of 8500. The posterior mean was E [µ | y] 10045 and the 95% credible interval was (9364, 10760). Download the fifile gamma.hc.csv.

This contains the output of a Stan implementation of the hierarchy (3)-(4), run with s = 8500. A total of 20, 000 samples of µ drawn from the posterior distribution is provided.

  1. Plot the histogram of the samples, and report on the posterior mean and the 95% credible intervals; compare these to the posterior mean and intervals found using the inverse-gamma prior from Assignment 1 (summarised above). [3 marks]

The second part of this question will look at fifinding the maximum a posteriori (MAP) estimator, which is found by maximising the posterior, or equivalently minimising the negative log-posterior, i.e,.

ˆµMAP = arg minµ {− log p(y | µ, φ)π(µ|s)} (5)

where we will assume φ is known or given. Please answer the following questions:

  1. Write down the formula for the negative log-posterior, i.e., log p(y | µ, φ)π(mu|s), up to constants not dependent on µ. Make sure to simplify the expression. [2 marks]
  1. Prove that maximising the posterior for µ is equivalent to solving

(+ 2)µ3 φY µ2 + nφs2µ φs2Y = 0

(6)where Y =P ni=1 yi. [2 marks]

  1. Download the function gamma.hc.map.R. This contains the function gamma.map(y,s,phi) which fifinds the MAP estimator by solving equation (6), given a value of φ.

Using this function and the data in daily.covid.cases.07.2022.csv, compute the MAP estimator for s = 8500 (our prior best guess); for the value of φ, use the posterior mean of φ from the samples provided above in gamma.hc.csv. Compare this estimate to the posterior mean using the half-Cauchy found in Question 1.1. Discuss why you think they are similar/difffferent. [1 mark]

  1. Using function gamma.map(y,s,phi), explore the sensitivity of the MAP estimator for our Covid-19 daily case data when using choices of prior best guess that are quite difffferent from our guess based on the SARS recovery time. In particular, try the values s =  10, 101, 102 , . . . , 106, 107 .

Plot the MAP estimates using these values of s against the values of s. How do these estimates compare to using s = 8500? What does this say about the half-Cauchy prior? (hint: use the log-scale for the x-axis) [2 marks]

  1. Find the asymptotic formulae for the MAP estimate of µ, i.e., the solution to (6) when (i) s 0,and (ii) s → ∞. Comment on these. [2 marks]

As discussed in Assignment 1, it is sometimes more natural to use the alternative parameterisation v = log µ for the gamma distribution.

  1. Transform the half-Cauchy prior (2) on µ to a prior on v using the transformation of random variables technique from Lecture 5. [2 marks]
  1. Plot this prior distribution for the choice of hyperparameters s = 10, s = 102 and s = 103 . How does s affffect the prior on v? [1 mark]
bestdaixie

评论已关闭。