1 / 13

Presentation of Question 3

Presentation of Question 3. Sun Jie U093351B. 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))

mikkel
Download Presentation

Presentation of Question 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Presentation of Question 3 Sun Jie U093351B

  2. 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)

  3. Prior1: Be(.5,.5)

  4. pmean=sum(pv*post)/sum(post) • pcdf=cumsum(post)/sum(post) • pmedian=.5*(max(pv[pcdf<.5])+min(pv[pcdf>.5])) • pmode=pv[which.max(post)] Point Estimate

  5. CI1=c(max(pv[pcdf<.025]),min(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)] Interval Estimate

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

  7. 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%)

  8. Prior2: N(1.5%, .25%)

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

  10. 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)

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

  12. Prior1: Be(.5,.5) Prior3: Exp(100) 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 • > pmean[1] 0.006266297 • > pmedian [1] 0.006225 • > pmode [1] 0.00615 • > CI1 [1] 0.00467 0.00807 • > CI2 [1] 0.00461 0.00799 • > pmean [1] 0.00628202 • > pmedian [1] 0.006235 • > pmode [1] 0.00616 • > CI1 [1] 0.00468 0.00810 • > CI2 [1] 0.00461 0.00802 Comparison

  13. Thank you. Questions?

More Related