# NOT RUN {
# }
# NOT RUN {
# Ex1: Predictive distribution for uniform p
Ex1 = dBetaBinomial( r=0:9,n=9,a=1,b=1)
Ex1
# Ex2: Predictive distribution at interim: n1=20, n=50
# Interim data: 4/20
# Probability to have 6 or more responders in 50 patients?
# That is: predictive probability >=2 in remaining 30?
# 1) Assume a weakly-informative Beta(a,1) prior with median 0.1 at trial start:
a = log(0.5)/log(0.1); b=1
p = dBetaBinomial(r=0:1,n=30,a=a+4,b=b+16)
1-sum(p)
# 2) Assume a uniform prior at trial start:
p = dBetaBinomial(r=0:1,n=30,a=1+4,b=1+16)
1-sum(p)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab