1. Let \(Y_1\) be the number of successes in \(n=10\) independent trials where each trial results in a success or failure, and p, the probability of success, remains constant over all trials. Suppose the 4 possible values of \(p\) are 0.20, 0.40, 0.60, and 0.80. We do not wish to favor any value over the others so we make them equally likely. We observe \(Y_1=7\). Find the posterior distribution by constructing the Bayes box.
p=seq(0.2,0.8, by=0.2)
prior= c(0.25,0.25,0.25,0.25)
likelihood=p^{7}*(1-p)^{3}
PL= prior*likelihood
posterior= PL/sum(PL)
bayesbox=as.data.frame(cbind(p,prior,likelihood,PL,posterior))
kable(bayesbox)
p prior likelihood PL posterior
0.2 0.25 0.0000066 0.0000016 0.0017112
0.4 0.25 0.0003539 0.0000885 0.0924064
0.6 0.25 0.0017916 0.0004479 0.4678075
0.8 0.25 0.0016777 0.0004194 0.4380749
  1. Suppose another \(n=5\) independent trials of the experiment are performed and \(Y_2=2\) successes are observed.Use the posterior distribution for \(p\) from Problem 1 as the prior distribution for \(p\). Find the new posterior distribution by constructing a Bayes box.
p=seq(0.2,0.8, by=0.2)
prior1= PL/sum(PL)
likelihood1=p^{2}*(1-p)^{3}
PL1= prior1*likelihood1
posterior1= PL1/sum(PL1)
bayesbox1=as.data.frame(cbind(p,prior1,likelihood1,PL1,posterior1 ))
kable(bayesbox1)
p prior1 likelihood1 PL1 posterior1
0.2 0.0017112 0.02048 0.0000350 0.0021567
0.4 0.0924064 0.03456 0.0031936 0.1965291
0.6 0.4678075 0.02304 0.0107783 0.6632856
0.8 0.4380749 0.00512 0.0022429 0.1380286
  1. Suppose we combine all the \(n=15\) trials all together and think of them as a single experiment where we observed a total of 9 successes. Start with the initial equally weighted prior from Problem No.1 and find the posterior after the single combined experiment. Construct the third Bayes box.
p=seq(0.2,0.8, by=0.2)
prior2= c(0.25,0.25,0.25,0.25)
likelihood2=p^{9}*(1-p)^{6}
PL2= prior2*likelihood2
posterior2= PL2/sum(PL2)
bayesbox2=as.data.frame(cbind(p,prior2,likelihood2,PL2,posterior2 ))
kable(bayesbox2)
p prior2 likelihood2 PL2 posterior2
0.2 0.25 1.00e-07 0.00e+00 0.0021567
0.4 0.25 1.22e-05 3.10e-06 0.1965291
0.6 0.25 4.13e-05 1.03e-05 0.6632856
0.8 0.25 8.60e-06 2.10e-06 0.1380286
  1. What do the results in Problem 1 through Problem 3 show?
    In problems 1 and 2, we show how sequential updating is performed were the posterior in the first problem is used as a prior to the second problem so that we will obtain an updated posterior while in problem 3, we obtain the posterior by performing a one-batch approach, were the posterior is obtained through the single combined experiment considering \(p\) are equally likely. Hence, the posterior for problems 1 and 2 are the same.

  2. It is believed that \(p\) is at least 0.60. Is there a strong evidence supporting this claim? Support your answer numerically.
    \(H_0:p\ge0.60\)
    \(H_1:p<0.60\)

\[\begin{align} P(H_0)&=P(p \ge0.60)\\ &=P(p=0.60) + P(p=0.80)\\ &=0.6632856 + 0.1380286\\ &\approx 0.8013\end{align}\]

Therefore, there is sufficient evidence to support the claim that \(p\) is at least 0.60.