Title: | Design and Simulation of Seamless Phase II-III Clinical Trials |
---|---|
Description: | Provides methods for generating, exploring and executing seamless Phase II-III designs of Lai, Lavori and Shih using generalized likelihood ratio statistics. Includes pdf and source files that describe the entire R implementation with the relevant mathematical details. |
Authors: | Balasubramanian Narasimhan [aut, cre], Mei-Chiung Shih [aut], Pei He [aut] |
Maintainer: | Balasubramanian Narasimhan <[email protected]> |
License: | LGPL-3 |
Version: | 0.9-1 |
Built: | 2024-10-25 03:15:40 UTC |
Source: | https://github.com/cran/sp23design |
This package implements the methodology described in the paper below
Package: | sp23design |
Type: | Package |
Version: | 1.0 |
Date: | 2011-05-05 |
License: | LGPL? |
LazyLoad: | yes |
The most important functions in this package are
generateSP23Design
, exploreSP23Design
,
executeSP23Design
, and analyzeSP23Design
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Maintainer: Balasubramanian Narasimhan <[email protected]>
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
## Not run: catn <- function(...) cat(..., "\n") trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) print(sp23Design) trialHistory <- exploreSP23Design(sp23Design, numberOfSimulations=25, rngSeed=rngSeed) result <- analyzeSP23Design(sp23Design, trialHistory)$designSummary catn("numberOfTimesH0RIsRejectedAtFirstLook", result[["numberOfTimesH0RIsRejectedAtFirstLook"]]) catn("numberOfTimesH0RIsRejected", result[["numberOfTimesH0RIsRejected"]]) catn("numberOfTimesStoppedForFutility", result[["numberOfTimesStoppedForFutility"]]) catn("numberOfTimesH0SIsAccepted", result[["numberOfTimesH0SIsAccepted"]]) catn("numberOfTimesH0SIsRejected", result[["numberOfTimesH0SIsRejected"]]) catn("numberOfTimesFutilityDecidedAtLastLook",result[["numberOfTimesFutilityDecidedAtLastLook"]]) catn("numberOfTimesTrialEndedAtLook", result[["numberOfTimesTrialEndedAtLook"]]) catn("avgExitTime", result[["avgExitTime"]]) ## End(Not run)
## Not run: catn <- function(...) cat(..., "\n") trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) print(sp23Design) trialHistory <- exploreSP23Design(sp23Design, numberOfSimulations=25, rngSeed=rngSeed) result <- analyzeSP23Design(sp23Design, trialHistory)$designSummary catn("numberOfTimesH0RIsRejectedAtFirstLook", result[["numberOfTimesH0RIsRejectedAtFirstLook"]]) catn("numberOfTimesH0RIsRejected", result[["numberOfTimesH0RIsRejected"]]) catn("numberOfTimesStoppedForFutility", result[["numberOfTimesStoppedForFutility"]]) catn("numberOfTimesH0SIsAccepted", result[["numberOfTimesH0SIsAccepted"]]) catn("numberOfTimesH0SIsRejected", result[["numberOfTimesH0SIsRejected"]]) catn("numberOfTimesFutilityDecidedAtLastLook",result[["numberOfTimesFutilityDecidedAtLastLook"]]) catn("numberOfTimesTrialEndedAtLook", result[["numberOfTimesTrialEndedAtLook"]]) catn("avgExitTime", result[["avgExitTime"]]) ## End(Not run)
executeSP23Design
or a history
of the actual conduct of a single trial is provided, it returns the
analysis results.
Produces analysis results from the run of a single trial or a number of simulations.
analyzeSP23Design(sp23Design, trialHistory = NULL, data = NULL, col=c("red", "red", "brown", "brown"), lty=c(1,2,1,2))
analyzeSP23Design(sp23Design, trialHistory = NULL, data = NULL, col=c("red", "red", "brown", "brown"), lty=c(1,2,1,2))
sp23Design |
The design object typically produced by calling
|
trialHistory |
Typically the result of calling |
data |
This is only used when the argument |
col |
Colors used for the survival plots |
lty |
Line types for the survival plots |
If trialHistory
is a single data frame, the naive response
estimates and a survival plot are produced. Otherwise, the counts of
the number of times the various hypothesis are rejected and other
details are returned.
A list of two items named responseSummary
and designSummary
If trialHistory
is a single data frame, the naive response
estimates are returned in responseSummary
and a survival plot
is produced. Otherwise, the counts of the number of times the various
hypothesis are rejected and other details are returned in
designSummary
.
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
## Not run: catn <- function(...) cat(..., "\n") trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) print(sp23Design) trialHistory <- exploreSP23Design(sp23Design, numberOfSimulations=25, rngSeed=rngSeed) result <- analyzeSP23Design(sp23Design, trialHistory)$designSummary catn("numberOfTimesH0RIsRejectedAtFirstLook",result[["numberOfTimesH0RIsRejectedAtFirstLook"]]) catn("numberOfTimesH0RIsRejected", result[["numberOfTimesH0RIsRejected"]]) catn("numberOfTimesStoppedForFutility", result[["numberOfTimesStoppedForFutility"]]) catn("numberOfTimesH0SIsAccepted", result[["numberOfTimesH0SIsAccepted"]]) catn("numberOfTimesH0SIsRejected", result[["numberOfTimesH0SIsRejected"]]) catn("numberOfTimesFutilityDecidedAtLastLook",result[["numberOfTimesFutilityDecidedAtLastLook"]]) catn("numberOfTimesTrialEndedAtLook", result[["numberOfTimesTrialEndedAtLook"]]) catn("avgExitTime", result[["avgExitTime"]]) ## End(Not run)
## Not run: catn <- function(...) cat(..., "\n") trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) print(sp23Design) trialHistory <- exploreSP23Design(sp23Design, numberOfSimulations=25, rngSeed=rngSeed) result <- analyzeSP23Design(sp23Design, trialHistory)$designSummary catn("numberOfTimesH0RIsRejectedAtFirstLook",result[["numberOfTimesH0RIsRejectedAtFirstLook"]]) catn("numberOfTimesH0RIsRejected", result[["numberOfTimesH0RIsRejected"]]) catn("numberOfTimesStoppedForFutility", result[["numberOfTimesStoppedForFutility"]]) catn("numberOfTimesH0SIsAccepted", result[["numberOfTimesH0SIsAccepted"]]) catn("numberOfTimesH0SIsRejected", result[["numberOfTimesH0SIsRejected"]]) catn("numberOfTimesFutilityDecidedAtLastLook",result[["numberOfTimesFutilityDecidedAtLastLook"]]) catn("numberOfTimesTrialEndedAtLook", result[["numberOfTimesTrialEndedAtLook"]]) catn("avgExitTime", result[["avgExitTime"]]) ## End(Not run)
and
, compute
.
This function computes via
computeDGivenXi(piVec, xiVec)
computeDGivenXi(piVec, xiVec)
piVec |
The two-element vector of |
xiVec |
The three-element vector of |
This is an approximation to the hazard ratio
The computed value of , a scalar
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
This function computes the variance of the generalized likelihood ratio statistic at interim stopping times
computeGammaSubT(thetaHat, pi, interimData)
computeGammaSubT(thetaHat, pi, interimData)
thetaHat |
The three-element vector of |
pi |
The two-element vector of |
interimData |
The interim data at time |
The function builds a hessian matrix and uses a reparametrization to
compute , the variance of the generalized likelihood
ration stochastic process at time
$t$.
A scalar value of the variance
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Compute the response end-point summary for interim data. This will include the proportion of responses, the proportion of people on treatment and control etc.
computeResponseSummary(interimData)
computeResponseSummary(interimData)
interimData |
The interim data for the clinical trial |
The result is a vector of counts and proportions
m0 |
number on control arm |
m1 |
number on treatment arm |
y0 |
number of responses in control |
y1 |
number of responses in treatment |
numberOfTotalResponses |
number of total responses in both arms |
controlRespProp |
the proportion of responders in control arm |
treatmentRespProp |
the proportion of responders in the treatment arm |
pooledProp |
the pooled response proportion |
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) dInterim <- generateInterimData(d, trialParameters$interimLookTime[2], trialParameters$adminCensoringTime) computeResponseSummary(dInterim) ## End(Not run)
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) dInterim <- generateInterimData(d, trialParameters$interimLookTime[2], trialParameters$adminCensoringTime) computeResponseSummary(dInterim) ## End(Not run)
This function is designed to be used in the field. Assuming a particular design is chosen, it conducts the interim analysis for a specific calendar time and provides the means for deciding whether to stop for futility or efficacy.
executeSP23Design(sp23DesignObject, data, currentCalendarTime)
executeSP23Design(sp23DesignObject, data, currentCalendarTime)
sp23DesignObject |
A seamless phase II-III design object, typically one produced by the
|
data |
The interim data, something akin to that produced by the function
|
currentCalendarTime |
The current calendar time of the interim data. This better be one of the specified interim looks, or the function stops. |
This function is designed to be used in the field, although there are parts of it that are currently problematic. For example, in the field, there is typically no inkling of a responder or non-responder and yet the function as it currently stands is too wedded to the simulation scenario. Not hard to fix though.
A vector of quantities is returned.
m0 |
number on control arm |
m1 |
number on treatment arm |
y0 |
number of responses in control |
y1 |
number of responses in treatment |
pi0Hat |
estimate of the proportion of responders among control |
pi1Hat |
estimate of the proportion of responders among treatment |
pi0HatH0 |
estimate of the proportion of responders among control
under |
pi1HatH0 |
estimate of the proportion of responders among control
under |
pi0HatH1 |
estimate of the proportion of responders among control
under |
pi1HatH1 |
estimate of the proportion of responders among control
under |
glrRespH0 |
estimate of the generalized likelihood ratio
statistic for response under |
glrRespH1 |
estimate of the generalized likelihood ratio
statistic for response under |
glrSurvH0 |
estimate of the generalized likelihood ratio
statistic for survival under |
glrSurvH1 |
estimate of the generalized likelihood ratio
statistic for survival under |
alphaHat |
the estimate of |
alphaHatH0 |
the estimate of |
alphaHatH1 |
the estimate of |
betaHat |
the estimate of |
betaHatH0 |
the estimate of |
betaHatH1 |
the estimate of |
gammaHat |
the estimate of |
gammaHatH0 |
the estimate of |
gammaHatH1 |
the estimate of |
hazard |
the estimate of |
v |
the estimate of |
rejectH0R |
a flag indicating if $H_0^R$ was rejected at the interim look |
acceptH0R |
a flag indicating if $H_0^R$ was accepted (futility) at the interim look |
rejectH0S |
a flag indicating if $H_0^S$ was rejected at the interim look |
acceptH0S |
a flag indicating if $H_0^S$ was accepted (futility) at the interim look |
b.metas.Last |
the last Haybittle-Peto boundary for the survival end-point, if computed |
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) result <- executeSP23Design(sp23Design, d, trialParameters$interimLookTime[2]) ## End(Not run)
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) result <- executeSP23Design(sp23Design, d, trialParameters$interimLookTime[2]) ## End(Not run)
Explore a chosen design by generating simulated datasets and storing data from simulations for further analysis
exploreSP23Design(sp23Design, numberOfSimulations = 25, rngSeed = 12345, showProgress = TRUE)
exploreSP23Design(sp23Design, numberOfSimulations = 25, rngSeed = 12345, showProgress = TRUE)
sp23Design |
A design object typically created by the function |
numberOfSimulations |
The number of simulations to use, default 25 |
rngSeed |
A seed for the random number generator for reproducibility |
showProgress |
A flag (default |
This function is used while exploring the characteristics of a design. Results are accumulated and can be fed into analysis functions to inform choices.
A list of length numberOfSimulations
where each entry is a data
frame with number of interim looks rows and the following variables in
the column.
m0 |
number on control arm |
m1 |
number on treatment arm |
y0 |
number of responses in control |
y1 |
number of responses in treatment |
pi0Hat |
estimate of the proportion of responders among control |
pi1Hat |
estimate of the proportion of responders among treatment |
pi0HatH0 |
estimate of the proportion of responders among control
under |
pi1HatH0 |
estimate of the proportion of responders among control
under |
pi0HatH1 |
estimate of the proportion of responders among control
under |
pi1HatH1 |
estimate of the proportion of responders among control
under |
glrRespH0 |
estimate of the generalized likelihood ratio
statistic for response under |
glrRespH1 |
estimate of the generalized likelihood ratio
statistic for response under |
glrSurvH0 |
estimate of the generalized likelihood ratio
statistic for survival under |
glrSurvH1 |
estimate of the generalized likelihood ratio
statistic for survival under |
alphaHat |
the estimate of |
alphaHatH0 |
the estimate of |
alphaHatH1 |
the estimate of |
betaHat |
the estimate of |
betaHatH0 |
the estimate of |
betaHatH1 |
the estimate of |
gammaHat |
the estimate of |
gammaHatH0 |
the estimate of |
gammaHatH1 |
the estimate of |
hazard |
the estimate of |
v |
the estimate of |
rejectH0R |
a flag indicating if $H_0^R$ was rejected at the interim look |
acceptH0R |
a flag indicating if $H_0^R$ was accepted (futility) at the interim look |
rejectH0S |
a flag indicating if $H_0^S$ was rejected at the interim look |
acceptH0S |
a flag indicating if $H_0^S$ was accepted (futility) at the interim look |
b.metas.Last |
the last Haybittle-Peto boundary for the survival end-point, if computed |
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, 2011, (submitted).
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) ## Case C of table 1 in paper caseC.TrueParameters <- list(p0 = 0.3, p1 = 0.6, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) ## Do case C as example sp23Design <- generateSP23Design(caseC.TrueParameters, trialParameters) trialHistory <- exploreSP23Design(sp23Design, numberOfSimulations=25, rngSeed=2387487) ## End(Not run)
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) ## Case C of table 1 in paper caseC.TrueParameters <- list(p0 = 0.3, p1 = 0.6, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) ## Do case C as example sp23Design <- generateSP23Design(caseC.TrueParameters, trialParameters) trialHistory <- exploreSP23Design(sp23Design, numberOfSimulations=25, rngSeed=2387487) ## End(Not run)
The data is generated according to the model specified in the reference below, specifically,
generateClinicalTrialData(nRec, nFUp, pi0, pi1, theta, lambda0, blockSize = 10)
generateClinicalTrialData(nRec, nFUp, pi0, pi1, theta, lambda0, blockSize = 10)
nRec |
the number of patients recruited every year. Length(nRec) is the number of years of recruitment |
nFUp |
the number of additional years of followup |
pi0 |
the probability of response under control arm |
pi1 |
the probability of response under treatment arm |
theta |
the three dimensional parameter |
lambda0 |
the baseline hazard rate |
blockSize |
the size of the blocks for randomization of the treatment/control; we use block randomization |
Generates data from an exponentail distribution according to the model and adhering to the recruitment goals for each calendar year
A data frame consisting of the following variables.
entryTime |
entry time of the patient into the trial |
responseIndicator |
an indicator of patient being a responder or not |
treatmentIndicator |
an indicator of patient being in treatment arm or control |
timeToEvent |
the time to event or death in the language of the paper |
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda)
trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda)
Generate interim data at a given time from a dataset
generateInterimData(clinicalTrialDF, interimTime, administrativeCensoringTime)
generateInterimData(clinicalTrialDF, interimTime, administrativeCensoringTime)
clinicalTrialDF |
The data frame from which to generate the interim data. It is assumed
that the variables |
interimTime |
the interim time for which the data is to generated |
administrativeCensoringTime |
The administrative censoring time when the study concludes |
As it stands this function also is geared towards the simulation scenario. Needs to be cleaned up a bit.
Returns a subset of the input data frame with the following additional variables.
delta |
the event indicator |
eventTime |
calendar event time |
Furthermore, the timeToEvent
variable is appropriately
calculated
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) dInterim <- generateInterimData(d, trialParameters$interimLookTime[2], trialParameters$adminCensoringTime)
trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) dInterim <- generateInterimData(d, trialParameters$interimLookTime[2], trialParameters$adminCensoringTime)
Generate a seamless Phase II-III design object given some the true parameters and clinical trial parameters
generateSP23Design(trueParameters, trialParameters)
generateSP23Design(trueParameters, trialParameters)
trueParameters |
A list constisting of several components
including
|
trialParameters |
A list constisting of several components
including
|
Generates a design object that is used throughout the simulation or an actual analysis.
An informal sp23Design
object, a list of four items
trueParameters |
exactly the input above |
trialParameters |
exactly the input above |
glrBoundary |
a matrix of dimension number of interim looks by 4, containing the boundaries for futility and efficacy for both response and survival |
interimLookHistoryDF |
A data frame as described in
|
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
exploreSP23Design
and examples in the examples
subdirectory of this package
## trial parameters in paper trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) ## Case C of table 1 in paper caseC.TrueParameters <- list(p0 = 0.3, p1 = 0.6, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) ## Do case C as example sp23Design <- generateSP23Design(caseC.TrueParameters, trialParameters)
## trial parameters in paper trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) ## Case C of table 1 in paper caseC.TrueParameters <- list(p0 = 0.3, p1 = 0.6, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) ## Do case C as example sp23Design <- generateSP23Design(caseC.TrueParameters, trialParameters)
A utility function to compute the hessian of the generalized (conditional) partial likelihood ratio statistic
hessian(theta, pi, interimData)
hessian(theta, pi, interimData)
theta |
The three-element vector |
pi |
The two-element vector |
interimData |
The interim data frame |
Computes the hessian
A 33 matrix of the hessian
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Compute the response log-likelihood
loglik1(piVec, respSummary)
loglik1(piVec, respSummary)
piVec |
The two-element vector of |
respSummary |
A vector consisting of the summary of data described in
|
Computes the log-likelihood
the log-likelihood
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Computes the constrained response log-likelihood (on the alternative)
loglik1GivenDelta(p, respSummary, delta = 0)
loglik1GivenDelta(p, respSummary, delta = 0)
p |
The probability |
respSummary |
A vector consisting of the summary of data described in
|
delta |
The scalar value of the difference |
Computes the constrained response log-likelihood (on the alternative)
the (constrained) response log likelihood
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Computes the survival log-likelihood
loglik2(theta, interimData)
loglik2(theta, interimData)
theta |
the three-element vector of |
interimData |
The interim data |
Computes the survival log-likelihood
the survival log-likelihood
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Computes the constrained survival log-likelihood
loglik2.repar0(xi, interimData, pi0, pi1, eta.hyp = 0)
loglik2.repar0(xi, interimData, pi0, pi1, eta.hyp = 0)
xi |
the three-element vector of |
interimData |
the interim data |
pi0 |
the value |
pi1 |
the value |
eta.hyp |
The hypothesised difference |
This uses the reparametrization above in terms of rather
than
The constrained survival log-likelihood
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Compute the modified Haybittle-Peto boundary
mHP.b(mu = c(0, 0), v = c(1, 2), alpha = 0.05, eps = 1/2, side = c("one", "two"))
mHP.b(mu = c(0, 0), v = c(1, 2), alpha = 0.05, eps = 1/2, side = c("one", "two"))
mu |
The mean vector |
v |
The variance vector, usually proportional to information in calendar time |
alpha |
The significance desired |
eps |
The fraction of alpha to use |
side |
one-sided or two-sided ( |
Compute the modified Haybittle-Peto boundary
the modified Haybittle-Peto boundary
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Compute the modified Haybittle-Peto boundary for the final look
mHP.c(mu = c(0, 0, 0), v = c(1, 2, 3), b = 3, alpha = 0.05, eps = 1/2, side = c("one", "two"))
mHP.c(mu = c(0, 0, 0), v = c(1, 2, 3), b = 3, alpha = 0.05, eps = 1/2, side = c("one", "two"))
mu |
the mean vector |
v |
The variance vector, usually proportional to information in calendar time |
b |
The (constant) modified Haybittle-Peto boundary, typically computed
by |
alpha |
The significance level desired |
eps |
The fraction of alpha to use |
side |
one-sided or two-sided ( |
Compute the modified Haybittle-Peto boundary for the final look
the modified Haybittle-Peto boundary for the final look
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
Perform an interim look in a seamless Phase II-III clinical trial
performInterimLook(k, trueParameters, trialParameters, glrBoundary, interimData, interimLookHistoryDF, argRejectH0R)
performInterimLook(k, trueParameters, trialParameters, glrBoundary, interimData, interimLookHistoryDF, argRejectH0R)
k |
the index of the look |
trueParameters |
the true parameters, usually available in an object generated by
|
trialParameters |
the trial parameters, usually available in an object generated by
|
glrBoundary |
the generalized likelihood ratio boundaries, usually available in
an object produced by |
interimData |
the interim data |
interimLookHistoryDF |
the interim look history data frame matrix described in
|
argRejectH0R |
A flag that indicates whether |
Perform an interim look in a seamless Phase II-III clinical trial
a vector of named values described in
exploreSP23Design
, essentially providing a new row to
the interim look history data frame
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) dInterim <- generateInterimData(d, trialParameters$interimLookTime[1], trialParameters$adminCensoringTime) dInterim <- dInterim[order(dInterim$timeToEvent), ] ## This is a tricky function to use for all but the first interim look; ## see executeSP23Design code for details! Reason: interim look k depends ## on results of interim look k-1 ## performInterimLook(1, sp23Design$trueParameters, trialParameters, sp23Design$glrBoundary, dInterim, sp23Design$interimLookHistoryDF, argRejectH0R = FALSE)
trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) trueParameters <- list(p0 = 0.3, p1 = 0.3, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) rngSeed <- 9872831 sp23Design <- generateSP23Design(trueParameters, trialParameters) d <- generateClinicalTrialData(nRec = trialParameters$numberRecruitedEachYear, nFUp = trialParameters$followupTime, pi0 = trueParameters$p0, pi1 = trueParameters$p1, theta = trueParameters$theta, lambda0 = trueParameters$baselineLambda) dInterim <- generateInterimData(d, trialParameters$interimLookTime[1], trialParameters$adminCensoringTime) dInterim <- dInterim[order(dInterim$timeToEvent), ] ## This is a tricky function to use for all but the first interim look; ## see executeSP23Design code for details! Reason: interim look k depends ## on results of interim look k-1 ## performInterimLook(1, sp23Design$trueParameters, trialParameters, sp23Design$glrBoundary, dInterim, sp23Design$interimLookHistoryDF, argRejectH0R = FALSE)
Reset the design object so that counts and results are zeroed out
resetSP23Design(sp23Design)
resetSP23Design(sp23Design)
sp23Design |
An object usually the result of |
Reset the design object so that counts and results are zeroed out
A new sp23Design
object with counts and results zeroed out
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) ## Case C of table 1 in paper caseC.TrueParameters <- list(p0 = 0.3, p1 = 0.6, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) ## Do case C as example sp23Design <- generateSP23Design(caseC.TrueParameters, trialParameters) ## do something ... sp23Design <- resetSP23Design(sp23Design) ## End(Not run)
## Not run: trialParameters <- list(minimumNumberOfEvents = 20, minimumIncreaseInV = 0.2, numberRecruitedEachYear = c(80, 120, 160, 160), followupTime = 3, adminCensoringTime = 7, interimLookTime = c(1, 2, 3, 5, 7), type1ErrorForResponse = 0.05, type2ErrorForResponse = 0.01, glrBoundarySidedness = "one", # one sided or two-sided type1Error = 0.05, type2Error = 0.10, epsType1 = 1/3, epsType2 = 1/3) ## Case C of table 1 in paper caseC.TrueParameters <- list(p0 = 0.3, p1 = 0.6, pdiffHyp=0.3, theta = list( alpha = 0, beta = 0, gamma = 0), baselineLambda = 0.35, etaHyp = 0.25) ## Do case C as example sp23Design <- generateSP23Design(caseC.TrueParameters, trialParameters) ## do something ... sp23Design <- resetSP23Design(sp23Design) ## End(Not run)
in terms of others
,
,
A convenience function to reduce dimension by solving for one variable
in terms of others
,
,
solveForCGivenABD(piVec, a, b, d)
solveForCGivenABD(piVec, a, b, d)
piVec |
The two-element vector of |
a |
The value for |
b |
The value for |
d |
The value for |
Just solves the equation in closed form
the value for
Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He
Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, Volume 31, issue 18, p.1944-1960, 2012.