Let p denote the probability that a particular coin will show heads when randomly tossed. It is not necessarily true that the coin is a “fair” coin wherein p=1/2. Find the a posteriori probability density function f(p|TN ) where TN is the observed number of heads n observed in N tosses of a coin. The a priori density is p~U[0.2,0.8], i.e., uniform over this interval. Make some plots of the a posteriori density.
I have written a code in R that will plot posterior density
Code:::::::::::::
#take N=10,n=0,10
#Above values of 'n' are taken for sake of easiness only
N=10;n<-c(0,10);p<-seq(0.2,0.8,by=0.002);fn<-vector()
fn1<-p^n[1]*(1-p)^(10-n[1])*11/((0.8)^(11)-(0.2)^(11))
fn2<-p^n[2]*(1-p)^(10-n[2])*11/((0.8)^(11)-(0.2)^(11))
plot(fn1,p)
plot(fn2,p)
Outputs:::::::::
Get Answers For Free
Most questions answered within 1 hours.