R代写-STAT 8150/7150-Assignment1

Bayesian Data Analysis Assignment1: Due Week 5, 2021
STAT 8150/7150
Instructions:
This assignment covers weeks 1, 2, and 3. Each question is worth 20 marks. The question
1 does not involved any computation through R software. However you will use the R
software and provide your code for solving question 2.
1. Due on 28th March 2021
2. For all the questions please provide the relevant mathematical derivations, the com-
puter programs (only using R software) and the plots.
3. Please submit on iLearn a single PDF file containing all your work (code, compu-
tations, plots, etc.). Other file formats (e.g. Word, html) will NOT be accepted.
4. Try to use Rmarkdown through Rstudio. But it is not compulsory to use Rmark-
down even if facilitate to reproduce results. Only upload the pdf file.
1 of 3
Bayesian Data Analysis Assignment1: Due Week 5, 2021
1. Question 1 (20 marks)
(a) The geometric distribution is given by
p(y|θ) = (1− θ)yθ, y = 0, 1, 2, . . .
for 0 < θ < 1. Suppose independent data y1, . . . , yn are observed from this distribu-
tion.
i. (3 marks) If the prior for θ is taken as Beta(α, β), determine the posterior
distribution of θ as a Beta distribution.
ii. (2 marks) What are the posterior mean and variance of θ?
(b) For the geometric distribution and data of question 1(a), suppose the prior p(θ) is
taken with
p(θ) ∝ θ2(1− θ)2, 0 < θ < 1.
i. (3 marks) Determine the posterior distribution of θ if
∑n
j=1 yj = 2n.
ii. (3 marks) What are the posterior mean and variance of θ?
iii. (3 marks) Determine an approximate 95% credible interval for θ if the value of
n is large.
(c) The posterior predictive probability for a new observation y˜ given data y = (y1, . . . , yn)
is given by
p(y˜|y) =
∫ 1
0
p(y˜|θ)p(θ|y) dθ,
with
p(y˜|θ) = (1− θ)y˜θ, y˜ = 0, 1, 2, . . .
i. (3 marks) Determine the posterior predictive probability of y˜ = 1 as an expres-
sion involving the posterior mean and variance. Assume that the prior and data
of question 1(b), above, give the form of the posterior p(θ|y).
ii. (3 marks) If a new observation yn+1 is available, show how the posterior for data
(y1, . . . , yn) from question 1(b), above, can be updated to give a new posterior
for θ based on (y1, . . . , yn, yn+1).
2 of 3
Bayesian Data Analysis Assignment1: Due Week 5, 2021
2. Question 2 (20 marks)
The table below has the overall free throw proportion and results of free throws taken
in pressure situations, defined as “clutch” (https://stats.nba.com/), for ten National
Basketball Association players (those that received the most votes for the Most Valuable
Player Award) for the 2016–2017 season. Since the overall proportion is computed using
a large sample size, assume it is fixed and analyze the clutch data for each player
separately using Bayesian methods. Assume a uniform prior throughout this problem.
Overall Clutch Clutch
Player proportion makes attempts
Russell Westbrook 0.845 64 75
James Harden 0.847 72 95
Kawhi Leonard 0.880 55 63
LeBron James 0.674 27 39
Isaiah Thomas 0.909 75 83
Stephen Curry 0.898 24 26
Giannis Antetokounmpo 0.770 28 41
John Wall 0.801 66 82
Anthony Davis 0.802 40 54
Kevin Durant 0.875 13 16
(a) (4 marks) Describe your model for studying the clutch success probability including
the likelihood and prior. (one model per player)
(b) (3 marks) Plot the posteriors of the clutch success probabilities. As you have build
one model per player, you should plot all the posteriors on the same plot.
(c) (3 marks) Summarize the posteriors in a table by presenting the posterior median
and the 95% credibility interval.
(d) (3 marks) Provide a second table including the MAP estimates, the posterior mean
and the Maximum likelihood estimates as well.
(e) (4 marks) Do you find evidence that any of the players have a different clutch
percentage than overall percentage?
(f) (3 marks) Are the results sensitive to your prior? That is, do small changes in the
prior lead to substantial changes in the posterior?
3 of 3