+ All Categories
Home > Documents > Presentation of Question 3

Presentation of Question 3

Date post: 07-Feb-2016
Category:
Upload: mikkel
View: 31 times
Download: 0 times
Share this document with a friend
Description:
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)) - PowerPoint PPT Presentation
Popular Tags:
13
Presentation of Question 3 Sun Jie U093351B
Transcript
Page 1: Presentation of Question 3

Presentation of Question 3Sun Jie

U093351B

Page 2: Presentation of Question 3

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)

Page 3: Presentation of Question 3

Prior1: Be(.5,.5)

Page 4: Presentation of Question 3

Point Estimate

• 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)]

Page 5: Presentation of Question 3

Interval Estimate

• 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)]

Page 6: Presentation of Question 3

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

Page 7: Presentation of Question 3

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)

Page 8: Presentation of Question 3

Prior2: N(1.5%, .25%)

Page 9: Presentation of Question 3

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

Page 10: Presentation of Question 3

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)

Page 11: Presentation of Question 3

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

Page 12: Presentation of Question 3

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

Page 13: Presentation of Question 3

Questions?

• Thank you.


Recommended