In a fruit packaging factory apples are examined to see whether they are blemished. A sample of $n$ apples is examined and, given the value of a parameter $\theta$ , representing the proportion of aples which are blemished, we regard $x$ , the number of blemished apples in the sample, as an obervation from the binomial $(n,\ \theta)$ distribution. The value of $\theta$ is unknown.  

Our prior density for $\theta$ is  

$$
f^{(0)}(\theta)=\left\{\begin{array}{l l}{k_{0}(20\theta(1-\theta)^{3}+1)}&{(0\leq\theta\leq1)}\\ {0}&{\mathrm{(otherwise)}}\end{array}\right..
$$  

(a) i. Show that, for $0\leq\theta\leq1$ , the prior density can be written as  

$$
f^{(0)}(\theta)=\frac{1}{2}\left\{\frac{\Gamma(6)}{\Gamma(2)\Gamma(4)}\theta^{2-1}(1-\theta)^{4-1}+\frac{\Gamma(2)}{\Gamma(1)\Gamma(1)}\theta^{1-1}(1-\theta)^{1-1}\right\}.
$$  

ii. Find the prior mean of $\theta$ .  
iii. Find the prior standard deviation of $\theta$ .i. Find the likelihood function.   
ii. Find the posterior density of $\theta$ .  
iii. Find the posterior mean of $\theta$ .  
iv. Use R to plot a graph showing both the prior and posterior densities of $\theta$ . (Hint: It is easier to get the vertical axis right if you plot the posterior density and then superimpose the prior density, rather than the other way round.)  