In a small survey, a random sample of 50 people from a large population is selected. Each person is asked a question to which the answer is either “Yes” or “No.” Let the proportion in the population who would answer “Yes” be $\theta$ . Our prior distribution for $\theta$ is a beta(1.5, 1.5) distribution. In the survey, 37 people answer “Yes.”  

(a) Find the prior mean and prior standard deviation of $\theta$ .  
(b) Find the prior probability that $\theta<0.6$ .  
(c) Find the likelihood.   
(d) Find the posterior distribution of $\theta$ .  
(e) Find the posterior mean and posterior standard deviation of $\theta$ .  
(f) Plot a graph showing the prior and posterior probability density functions of $\theta$ on the same axes.   
(g) Find the posterior probability that $\theta<0.6$ .  

Notes:  

The probability density function of a beta $(a,b)$ distribution is $f(x)=k x^{a-1}(1-x)^{b-1}$ where $k$ is a constant.  

If $X\sim\operatorname{beta}(a,b)$ then the mean of $X$ is  

$$
\operatorname{E}(X)={\frac{a}{a+b}}
$$  

and the variance of $X$ is  

$$
\operatorname{var}(X)={\frac{a b}{(a+b+1)(a+b)^{2}}}.
$$  

If $X\sim\operatorname{beta}(a,b)$ then you can use a command such as the following in $\mathrm{R}$ to find $\mathrm{Pr}(X<c)$ .  

pbeta(c,a,b)  

To plot the prior and posterior probability densities you may use R commands such as the following.  

theta<-seq(0.01,0.99,0.01)   
prior<-dbeta(theta,a,b)   
posterior<-dbeta(theta,c,d)   
plot(theta,posterior,xlab=expression(theta),ylab $=$ "Density",type="l")   
lines(theta,prior,lty=2)  