# CS代考 STAT314/461-21S2 (C) – cscodehelp代写

End-of-year Examinations, 2021

STAT314/461-21S2 (C)

Family Name/ Surname:

First Name/ Given Name:

ID number: Venue:

Seat Number:

STAT314/461-21S2 (C) Bayesian Inference

Time allowed: Number of questions: Number of pages:

Mathematics and Statistics EXAMINATION End-of-year Examinations, 2021

Instructions to Students:

• Answer all 4 questions.

• Write your name and student ID on top of EVERY page of your

• Write your answers on blank paper then scan and upload on com- pletion.

• There is a total of 60 marks.

• Show all workings.

• Open book exam

For Examiner Use Only Question Mark

Page 1 of 7

End-of-year Examinations, 2021 STAT314/461-21S2 (C)

Questions Start on Page 3

Page 2 of 7

End-of-year Examinations, 2021 STAT314/461-21S2 (C)

1. Question 1 (15 marks)

A local basketball club has 20 players, 2 of whom are experts and 18 are newbies. An expert gets a ball into the basket (i.e. scores) on 90% of all attempts, whereas a newbie does it with probability 50%.

(a) A random player has made 2 attempts and scored both times. What is the probability that they are an expert? (5 marks)

(b) What is the probability that the next attempt will be a miss? (Hint: think of posterior predictive distribution.) (5 marks)

(c) How many more goals (without any misses in between) would make you at least 95% certain that the player is an expert? (5 marks)

Page 3 of 7 Turn Over

End-of-year Examinations, 2021 STAT314/461-21S2 (C)

2. Question 2 (15 marks)

Continuing with the basketball example, let p denote the probability of scoring a goal on any one try. Then the probability that it took a player exactly = ∗ misses before scoring a goal is

Pr( =∗|p)=(1−p)∗p, for∗ =0,1,2,… Assume you have observations 1 , …, n for n players.

(a) Derive the maximum likelihood estimator for p. (Don’t forget the second order con- dition and assume the sample average ̄ is not zero.) (3 marks)

(b) Within the Bayesian framework, assume a beta prior for p: p ∼ Beta(, b),

and use Bayes’ formula to derive the posterior distribution ƒ(p|1,…,n).

(c) Find the posterior mean for p, E(p|1,…,n) based on the above distribution. What happens to it when the sample size increases? (Hint: think of what happens when the sample size goes to infinity.) (3 marks)

(d) For n = 3 players, the observed number of misses before a goal were 1, 8 and 0 respectively. Assuming a uniform prior for p, what is the posterior mean probability of scoring on any given attempt? (3 marks)

(e) Explain the difference between the classical p-value and the Bayesian posterior prob- ability in the context of hypothesis testing. (3 marks)

Page 4 of 7

End-of-year Examinations, 2021 STAT314/461-21S2 (C)

3. Question 3 (15 marks)

Figure 1: Convergence diagnostics: trace plots for three parallel Metropolis-Hastings chains for one of the parameters of a Poisson regression model

(a) Why is it important to check the convergence of MCMC procedures? (2 marks)

(b) Figure 1 displays traceplots for three parallel Metropolis-Hastings chains for one of the parameters of a Poisson regression model. The acceptance rates for the three chains were 96.5%, 95.1% and 94.6%. After discarding the first 1000 observations of each chain as burn-in the Gelman-Rubin convergence diagnostic Rˆ was 3.1. The effective Monte Carlo sample size, after discarding the first 1,000 iterations of each chain was Neff = 36.0. Apart from increasing the overall (or nominal) Monte Carlo sample size, What could be done to improve convergence and increase the effective Monte Carlo sample size for this Metropolis-Hastings procedure? (2 marks)

Page 5 of 7 Turn Over

End-of-year Examinations, 2021 STAT314/461-21S2 (C) (c) Again with respect to Figure 1, explain why the effective Monte Carlo sample size is

so much lower than the the nominal Monte Carlo sample size of 3, 000. (2 marks)

(d) Explain why the effective Monte Carlo sample size for importance sampling is usually less than the nominal Monte Carlo sample size. (2 marks)

(e) Suppose a Metropolis-Hastings algorithm based on an asymmetric jumping density, Jk(θ(k)|θ(k−1)), has been running for some time and by iteration k = (t − 1) produces a draw from the posterior density for the model parameter θ. That is,

p(θ(t−1) = θ∗) = p(θ = θ∗|dt), where θ∗ is any point in the parameter space.

Show that this implies that

p(θ(t−1) = θ, θ(t) = θb) = p(θ(t−1) = θb, θ(t) = θ)

for all θ and θb such that

p(θb|dt)Jt(θ|θb) ≥ p(θ|dt)Jt(θb|θ).

Page 6 of 7

End-of-year Examinations, 2021 STAT314/461-21S2 (C)

4. Question 4 (15 marks)

Suppose n people, sampled at random from the general population have been tested for Covid-19 with a new diagnostic test. Let Y = 1 denote a positive result and Y = 0 a negative result. The true disease status Z is not observed. Z = 1 denotes disease and Z = 0 denotes no disease. We let Y = (Y1,…,Yn) and Z = (Z1,…,Zn). One model for the test results is:

Z|φ∼Bernolli(φ), independentlyfor=1,…,n

Y |Z = 1, γ ∼ Bernolli(γ), independently for such that Z = 1

Y |Z = 0, β ∼ Bernolli(1 − β), independently for such that Z = 0

Suppose the weakly informative priors:

φ ∼ Bet(1, 9) γ ∼ Bet(8, 2) β ∼ Bet(9, 1)

are adopted and a priori independence is assumed, so that p(φ, γ, β) = p(φ)p(γ)p(β). (a) Sketch a DAG for this model. (2 marks)

(b) Write down the steps of a Gibbs sampler for this problem. (4 marks)

(c) Derive the full conditional posterior distributions for this problem. You may make use of standard conjugacy results in these derivations.

End of Examination

Page 7 of 7