# Vary accrual rate gamma to obtain power
# T, minfup and R all specified, although R will be adjusted on output
# gamma as input will be multiplied in output to achieve desired power
# Default method is Lachin and Foulkes
x_nsurv <- nSurv(
lambdaC = log(2) / 6, R = 10, hr = .5, eta = .001, gamma = 1,
alpha = 0.02, beta = .15, T = 36, minfup = 12, method = "LachinFoulkes"
)
# Demonstrate print method
print(x_nsurv)
# Same assumptions for group sequential design
x_gs <- gsSurv(
k = 4, sfl = gsDesign::sfPower, sflpar = .5, lambdaC = log(2) / 6, hr = .5,
eta = .001, gamma = 1, T = 36, minfup = 12, method = "LachinFoulkes"
)
print(x_gs)
# Demonstrate xtable method for gsSurv
print(xtable::xtable(x_gs,
footnote = "This is a footnote; note that it can be wide.",
caption = "Caption example for xtable output."
))
# Demonstrate nEventsIA method
# find expected number of events at time 12 in the above trial
nEventsIA(x = x_gs, tIA = 10)
# find time at which 1/4 of events are expected
tEventsIA(x = x_gs, timing = .25)
# Adjust accrual duration R to achieve desired power
# Trial duration T input as NULL and will be computed based on
# accrual duration R and minimum follow-up duration minfup
# Minimum follow-up duration minfup is specified
# We use the Schoenfeld method to compute accrual duration R
# Control median survival time is 6
nSurv(
lambdaC = log(2) / 6, hr = .5, eta = .001, gamma = 6,
alpha = .025, beta = .1, minfup = 12, T = NULL, method = "Schoenfeld"
)
# Same assumptions for group sequential design
gsSurv(
k = 4, sfu = gsDesign::sfHSD, sfupar = -4, sfl = gsDesign::sfPower, sflpar = .5,
lambdaC = log(2) / 6, hr = .5, eta = .001, gamma = 6,
T = 36, minfup = 12, method = "Schoenfeld"
) |>
print()
# Vary minimum follow-up duration minfup to obtain power
# Accrual duration R rate gamma are fixed and will not change on output.
# Trial duration T and minimum follow-up minfup are input as NULL
# and will be computed on output.
# We will use the Freedman method to compute sample size
# Control median survival time is 6
# Often this method will fail as the accrual duration and rate provide too
# little or too much sample size.
nSurv(
lambdaC = log(2) / 6, hr = .5, eta = .001, gamma = 6, R = 25,
alpha = .025, beta = .1, minfup = NULL, T = NULL, method = "Freedman"
)
# Same assumptions for group sequential design
gsSurv(
k = 4, sfu = gsDesign::sfHSD, sfupar = -4, sfl = gsDesign::sfPower, sflpar = .5,
lambdaC = log(2) / 6, hr = .5, eta = .001, gamma = 6,
T = 36, minfup = 12, method = "Freedman"
) |>
print()
# piecewise constant enrollment rates (vary accrual rate to achieve power)
# also piecewise constant failure rates
# will specify annualized enrollment and failure rates
nSurv(
lambdaC = -log(c(.95, .97, .98)), # 5%, 3% and 2% annual failure rates
S = c(1, 1), # 1 year duration for first 2 failure rates, 3rd continues indefinitely
R = c(.25, .25, 1.5), # 2-year enrollment with ramp-up over first 1/2 year
gamma = c(1, 3, 6), # 1, 3 and 6 annualized enrollment rates will be
# multiplied by ratio to achieve desired power
hr = .5, eta = -log(1 - .01), # 1% annual censoring rate
minfup = 3, T = 5, # 5-year trial duration with 3-year minimum follow-up
alpha = .025, beta = .1, method = "LachinFoulkes"
)
# Same assumptions for group sequential design
gsSurv(
k = 4, sfu = gsDesign::sfHSD, sfupar = -4, sfl = gsDesign::sfPower, sflpar = .5,
lambdaC = -log(c(.95, .97, .98)), # 5%, 3% and 2% annual failure rates
S = c(1, 1), # 1 year duration for first 2 failure rates, 3rd continues indefinitely
R = c(.25, .25, 1.5), # 2-year enrollment with ramp-up over first 1/2 year
gamma = c(1, 3, 6), # 1, 3 and 6 annualized enrollment rates will be
# multiplied by ratio to achieve desired power
hr = .5, eta = -log(1 - .01), # 1% annual censoring rate
minfup = 3, T = 5, # 5-year trial duration with 3-year minimum follow-up
alpha = .025, beta = .1, method = "LachinFoulkes"
) |>
print()
# combine it all: 2 strata, 2 failure rate periods
# Note that method = "LachinFoulkes" may be preferred here
nSurv(
lambdaC = matrix(log(2) / c(6, 12, 18, 24), ncol = 2), hr = .5,
eta = matrix(log(2) / c(40, 50, 45, 55), ncol = 2), S = 3,
gamma = matrix(c(3, 6, 5, 7), ncol = 2), R = c(5, 10), minfup = 12,
alpha = .025, beta = .1, method = "BernsteinLagakos"
)
# Same assumptions for group sequential design
gsSurv(
k = 4, sfu = gsDesign::sfHSD, sfupar = -4, sfl = gsDesign::sfPower, sflpar = .5,
lambdaC = matrix(log(2) / c(6, 12, 18, 24), ncol = 2), hr = .5,
eta = matrix(log(2) / c(40, 50, 45, 55), ncol = 2), S = 3,
gamma = matrix(c(3, 6, 5, 7), ncol = 2), R = c(5, 10), minfup = 12,
alpha = .025, beta = .1, method = "BernsteinLagakos"
) |>
print()
# Example to compute power for a fixed design.
# Trial duration T, minimum follow-up minfup and accrual duration R are all
# specified and will not change on output.
# beta=NULL will compute power and output will be the same as if beta were specified.
# This option is not available for group sequential designs.
nSurv(
lambdaC = log(2) / 6, hr = .5, eta = .001, gamma = 6, R = 25,
alpha = .025, beta = NULL, minfup = 12, T = 36, method = "LachinFoulkes"
) |>
print()
Run the code above in your browser using DataLab