# derive group sequential bound
x <- gsDesign(n.fix=100)
# upper bound summary
gsBoundSummary(x)
# lower bound summary
gsBoundSummary(x, upper=FALSE)
# print upper bound summary in latex format
xtable(x)
# print lower bound summary in latex format
xtable(x, upper=FALSE)
# now derive a design with a time-to-event endpoint
# note that by specifying endpoint="Survival", hazard ratio replaces treatment effect
ns <- nSurvival()
xs <- gsDesign(n.fix=ns$nEvents, nFixSurv=ns$n, endpoint="Survival")
gsBoundSummary(xs)
# generate some of the above summary statistics for the upper bound
z <- xs$upper$bound
# B-values
gsBValue(z=z, i=1:3, x=xs)
# hazard ratio
gsHR(z=z, i=1:3, x=xs)
# conditional power at observed treatment effect
gsCPz(z=z[1:2], i=1:2, x=xs)
# conditional power at H1 treatment effect
gsCPz(z=z[1:2], i=1:2, x=xs, theta=xs$delta)
# now look at a binomial endpoint; specify H0 treatment difference as p1-p2=.05
# now treatment effect at bound (say, thetahat) is transformed to
# xp$delta0 + xp$delta1*(thetahat-xp$delta0)/xp$delta
np <- nBinomial(p1=.15, p2=.10)
xp <- gsDesign(n.fix=np, endpoint="Binomial", delta1=.05)
gsBoundSummary(xp)
# estimate treatment effect at lower bound
# by setting delta0=0 (default) and delta1 above in gsDesign
# treatment effect at bounds is scaled to these differences
# in this case, this is the difference in event rates
gsDelta(z=xp$lower$bound, i=1:3, xp)
# binomial endpoint with risk ratio estimates
xrr <- gsDesign(n.fix=np, endpoint="Binomial", delta1=log(2/3))
gsRR(z=xp$lower$bound, i=1:3, xrr)
plot(xrr,plottype="RR")
Run the code above in your browser using DataLab