# Eliminate spending forany interim at or before 20 percent of information.
# Complete spending at first interim at or after 80 percent of information.
s<-sfLinear(alpha=.05,t=(0:100)/100,param=c(.5,.5))
plot((0:100)/100,s$spend,type="l",main="Accelerating spending with sfTruncated",
xlab="Proportion of information",ylab="Spending")
s<-sfTruncated(alpha=.05,t=(0:100)/100,param=list(sf=sfLinear,trange=c(.2,.8),param=c(.5,.5)))
lines(col=2,(0:100)/100,s$spend)
text("Accelerated (red) spending over interval (.2,.8)",x=.03,y=.045,pos=4)
# now apply this in gsDesign
# note how sfupar is set up to do as above
# 1st version produces an error next to last interim must be before final spend
# x<-gsDesign(k=5, sfu=sfTruncated, sfupar=list(sf=sfLinear, param=c(.5,.5),
# trange=c(.2,.8)))
# now final spend occurs at > next to last interim
x<-gsDesign(k=5, sfu=sfTruncated, sfupar=list(sf=sfLinear, param=c(.5,.5), trange=c(.2,.95)))
x
# The above means if final analysis is done a little early, all spending can occur
# Suppose we skip 4th interim due to fast enrollment and set calendar date
# based on estimated full information, but come up with only 97 pct of plan
xA <- gsDesign(k=x$k-1,n.I=c(x$n.I[1:3],.97*x$n.I[5]),test.type=x$test.type,
maxn.IPlan=x$n.I[x$k],sfu=sfTruncated,
sfupar=list(sf=sfLinear, param=c(.5,.5), trange=c(.2,.95)))
xA
Run the code above in your browser using DataLab