Let Y1 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 Y1 = 7. Find the posterior distribution by filling in the simplified table below.
p <- c(0.20,0.40,0.60,0.80)
prior <- c(0.25,0.25,0.25,0.25)
likelihood <- p^{7}*(1-p)^{3}
PL <- prior*likelihood
posterior <- PL/sum(PL)
Post <- as.data.frame(cbind(p, prior, likelihood, posterior))
knitr::kable(Post)
| 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 |
Suppose another 5 independent trials of the experiment are performed and Y2 = 2 successes are observed. Use the posterior distribution for p from No. 1 as the prior distribution for p. Find the new posterior distribution by filling in the simplified table below.
Prior <- c(0.00171123,0.09240642,0.46780749,0.43807487)
Likelihood <- p^{2}*(1-p)^{3}
PL <- Prior*Likelihood
post <- PL/sum(PL)
PostD <- as.data.frame(cbind(p, Prior, Likelihood, post))
knitr::kable(PostD)
| p | Prior | Likelihood | post |
|---|---|---|---|
| 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 |
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 No. 1 and find the posterior after the single combined experiment.
p <- c(0.20,0.40,0.60,0.80)
Prior<- c(0.25,0.25,0.25,0.25)
Likelihood <- p^{9}*(1-p)^{6}
PL <- Prior*Likelihood
post <- PL/sum(PL)
PostDATA <- as.data.frame(cbind(p, Prior, Likelihood, post))
knitr::kable(PostDATA)
| p | Prior | Likelihood | 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 No. 1 through No. 3 show? ANSWER:
The results in items 1 to 3 indicates how the assigned probabilities on the prior distribution for every possible value of p affects their respective posterior distribution.Items 1 and 3 obtained a prior distribution which assigns equal probability for for each value of p, while item 2 is a combination of the varied prior probabilities and the likelihood.
In this case, in item no. 1 we observe that as the probability of success (p) increases, the posterior probability also increases. Sequentially, as we update our prior in item 2 by supplying the values we obtained from the posterior distribution in item 1, there is also a positive relationship between p and posterior ( or as the value of p, increases the posterior also increases). Moreover, in item 3 after assuming it as a single experiment(by combining all trials) we observe that they have the same probabilities to the posterior in item no. 2 even though they have different proportions of success, 9/15 and 2/5 respectively.
This summarizes the pattern that through updating prior in item 2 by using posterior in item 1, the resulting posterior is the same to the posterior in item no. 3. Thus the results show that the posterior in both items 2 and 3 are equal.
b. It is believed that p is at least 0.60. Is there a strong evidence supporting this claim? Support your answer numerically.
ANSWER:
H0: p ≥ 0.60 Vs. H1: p < 0.60
P(H0) = P(p \(\ge\) 0.60) = P(p=0.60) + P(p=0.80) = 0.6632856 + 0.1380286 = 0.8013
Therefore, we can conclude that there is highly likely chance (80%) that the probability of success (p) is at least 0.60 or 60%