In: Statistics and Probability
A random spectator is to be selected from the audience of a basketball game and given the chance to shoot 10 free throws. Let Y be the number of free throws made by the selected spectator and let P be the probability with which the selected spectator makes a free throw on any attempt. Assume that P and Y follow the hierarchical model
Y |P ∼ Binomial(10, P)
P ∼ Beta(2, 2)
. (a) Run a Monte Carlo simulation to generate many realizations of Y.
Use the realizations of Y to get approximate values for
i. EY
. ii. Var Y .
(b) Find E[Y |P]
(c) Find E[Y ].
(d) Find Var[Y |P].
(e) Find Var[Y ]
. (f) Find values of α and β such that EY = 4 when P ∼ Beta(α, β).
(a) The following R code uses Monte Carlo simulation:
n_sim = 10000
y = replicate(n_sim, rbinom(1,10,rbeta(1,2,2)))
#E(Y):
mean(y)
#Var(Y):
sd(y)^2