# Presentation of Question 3 Sun Jie U093351B. Prior1: Be(.5,.5) pv=seq(0.00001,0.05,0.00001) xv=51; nv=8197 logf1= (xv-.5)*log(pv)+(nv-xv-.5)*log(1-pv)

## Presentation on theme: "Presentation of Question 3 Sun Jie U093351B. Prior1: Be(.5,.5) pv=seq(0.00001,0.05,0.00001) xv=51; nv=8197 logf1= (xv-.5)*log(pv)+(nv-xv-.5)*log(1-pv)"— Presentation transcript:

Presentation of Question 3 Sun Jie U093351B

Prior1: Be(.5,.5) pv=seq(0.00001,0.05,0.00001) xv=51; nv=8197 logf1= (xv-.5)*log(pv)+(nv-xv-.5)*log(1-pv) f2=exp(logf1-max(logf1)) intf2=sum(f2)*(pv[2]-pv[1]) post=f2/intf2 prior=dbeta(pv,.5,.5) plot(pv, prior,col="red",ylim=range(0:500)) points(pv,post)

Prior1: Be(.5,.5)

Point Estimate pmean=sum(pv*post)/sum(post) pcdf=cumsum(post)/sum(post) pmedian=.5*(max(pv[pcdf.5])) pmode=pv[which.max(post)]

Interval Estimate CI1=c(max(pv[pcdf.975])) threshold=max(post) coverage=0 for(i in seq(.999,.001,-.001)) { threshold=i*max(post) within=which(post>=threshold) coverage=pcdf[max(within)]-pcdf[min(within)] if(coverage>=.95)break() } CI2=pv[range(within)]

> pmean [1] 0.00628202 > pmedian [1] 0.006235 > pmode [1] 0.00616 > CI1 [1] 0.00468 0.00810 > CI2 [1] 0.00461 0.00802

Prior2: N(1.5%,.25%) pv=seq(0.00001,0.05,0.00001) xv=51; nv=8197 logf1= xv*log(pv)+(nv-xv)*log(1-pv)-(pv-.015)^2/(2*.0025^2) f2=exp(logf1-max(logf1)) intf2=sum(f2)*(pv[2]-pv[1]) post=f2/intf2 prior=dnorm(pv,mean=.015,sd=.0025) plot(pv, prior,col="red",ylim=range(0:500)) points(pv,post)

Prior2: N(1.5%,.25%)

> pmean[1] 0.007414297 > pmedian[1] 0.007375 > pmode[1] 0.00731 > CI1 [1] 0.00565 0.00936 > CI2 [1] 0.00559 0.00930

Prior3: Exp(100) pv=seq(0.00001,0.05,0.00001) xv=51; nv=8197 logf1= xv*log(pv)+(nv-xv)*log(1-pv)-100*pv f2=exp(logf1-max(logf1)) intf2=sum(f2)*(pv[2]-pv[1]) post=f2/intf2 prior=dexp(pv,rate=100) plot(pv, prior,col="red",ylim=range(0:500)) points(pv,post)

Prior3: Exp(100) > pmean [1] 0.006266297 > pmedian [1] 0.006225 > pmode [1] 0.00615 > CI1 [1] 0.00467 0.00807 > CI2 [1] 0.00461 0.00799

Comparison > pmean [1] 0.00628202 > pmedian [1] 0.006235 > pmode [1] 0.00616 > CI1 [1] 0.00468 0.00810 > CI2 [1] 0.00461 0.00802 Prior1: Be(.5,.5) > pmean[1] 0.007414297 > pmedian[1] 0.007375 > pmode[1] 0.00731 > CI1 [1] 0.00565 0.00936 > CI2 [1] 0.00559 0.00930 Prior2: N(1.5%,.25%) Prior3: Exp(100) > pmean [1] 0.006266297 > pmedian [1] 0.006225 > pmode [1] 0.00615 > CI1 [1] 0.00467 0.00807 > CI2 [1] 0.00461 0.00799

Questions? Thank you.

Download ppt "Presentation of Question 3 Sun Jie U093351B. Prior1: Be(.5,.5) pv=seq(0.00001,0.05,0.00001) xv=51; nv=8197 logf1= (xv-.5)*log(pv)+(nv-xv-.5)*log(1-pv)"

Similar presentations