Problem 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.20,0.80, by = 0.20)
prior = 1/length(p)
likelihood = p^(7)*(1-p)^(3)
PL = prior*likelihood
posterior = PL/sum(PL)
Bayesbox1 = as.data.frame(cbind(p,prior,likelihood,posterior))
knitr::kable(Bayesbox1)
p prior likelihood posterior
0.2 0.25 0.0000066 0.0017112
0.4 0.25 0.0003539 0.0924064
0.6 0.25 0.0017916 0.4678075
0.8 0.25 0.0016777 0.4380749

Problem 2

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 second Bayes box.

Prior = posterior
Likelihood = p^(2)*(1-p)^(3)
PL2 = Prior*Likelihood
Posterior = PL2/sum(PL2)
Bayesbox2 = as.data.frame(cbind(p,Prior,Likelihood,Posterior))
knitr::kable(Bayesbox2)
p Prior Likelihood Posterior
0.2 0.0017112 0.02048 0.0021567
0.4 0.0924064 0.03456 0.1965291
0.6 0.4678075 0.02304 0.6632856
0.8 0.4380749 0.00512 0.1380286

Problem 3

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.

prior = 1/length(p)
likelihood3= p^(9)*(1-p)^(6)
PL3 = prior*likelihood3
post = PL3/sum(PL3)
Bayesbox3 = as.data.frame(cbind(p,prior,likelihood3,post))
knitr::kable(Bayesbox3)
p prior likelihood3 post
0.2 0.25 1.00e-07 0.0021567
0.4 0.25 1.22e-05 0.1965291
0.6 0.25 4.13e-05 0.6632856
0.8 0.25 8.60e-06 0.1380286

a. What do the results in Problem 1 through Problem 3 show?

We know that the posterior distribution is proportional to the product of the prior distribution and the likelihood. Thus, there are two probability distributions which will influence the posterior distribution. Results in problem 1 support the claim that \(p=0.6\) since the probability of success \(p = \frac {7}{10} \approx 0.7\), although the prior distribution was made equally likely, the posterior distribution shows larger proportion between \(p = 0.6\) and \(p=0.8\) considering the p is believed to be 0.6. The probability of success in problem 2 is \(p= \frac {2}{5} \approx 0.4\), the given likelihood have no effect to the posterior as prior used in the problem was the posterior distribution of the previous one, and the low sample number also influenced the posterior with the proportion to be greatest in \(p=0.6\). Combining all trials together in Problem 3 with the prior equally weighted in each probability of success p leads to a strong evidence to support the claim that probability of success is, \(p=0.6\), with number of successes \(Y = 7\) and independent trials \(n = 15\).

b. It is believed that p is at least 0.60. Is there a strong evidence supporting this claim? Support your answer numerically.

Using the classical estimator, which is given by

p= probability of success, s = number of success, n = total number of trials

\[p = \frac {\text {number of success}}{\text{total number of trials }} \]

\[p = \frac {9}{15} \approx 0.6\]

Therefore, we can say that the probability of success p is at least 0.60.