Package 'sp23design'

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

Help Index


sp23design: A package for the design, exploration and execution of seamless Phase II-II clinical trials

Description

This package implements the methodology described in the paper below

Details

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

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

Maintainer: Balasubramanian Narasimhan <[email protected]>

References

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.

Examples

## 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)

Analyses the results of running a design. If a trial history, such as the result of the function executeSP23Design or a history of the actual conduct of a single trial is provided, it returns the analysis results.

Description

Produces analysis results from the run of a single trial or a number of simulations.

Usage

analyzeSP23Design(sp23Design, trialHistory = NULL, data = NULL,
  col=c("red", "red", "brown", "brown"), lty=c(1,2,1,2))

Arguments

sp23Design

The design object typically produced by calling generateSP23Design.

trialHistory

Typically the result of calling executeSP23Design which is a single data frame, or, the result produced by calling exploreSP23Design which is a list of data frames, one for each simulation.

data

This is only used when the argument trialHistory is a single data frame, in which case, it should be the data generated in the clinical trial.

col

Colors used for the survival plots

lty

Line types for the survival plots

Details

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.

Value

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.

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

## 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)

Given the estimates of the π\pi and θ\theta, compute dd.

Description

This function computes dd via

d(π,ξ)={π0a+(1π0)}{π1abc+(1π1)b}d(\pi,\xi)=\{ \pi_0 a + (1-\pi_0)\} - \{\pi_1 abc + (1-\pi_1)b \}

Usage

computeDGivenXi(piVec, xiVec)

Arguments

piVec

The two-element vector of (π0,π1)(\pi_0, \pi_1)

xiVec

The three-element vector of (a=eα,b=eβ,c=eγ)(a=e^\alpha, b=e^\beta, c=e^\gamma)

Details

This is an approximation to the hazard ratio

Value

The computed value of dd, a scalar

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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 estimate of the variance of the generalized likelihood ratio statistic at time tt

Description

This function computes the variance of the generalized likelihood ratio statistic at interim stopping times

Usage

computeGammaSubT(thetaHat, pi, interimData)

Arguments

thetaHat

The three-element vector of (α,β,γ)(\alpha, \beta, \gamma)

pi

The two-element vector of (π0,π1)(\pi_0, \pi_1)

interimData

The interim data at time tt as a data frame

Details

The function builds a hessian matrix and uses a reparametrization to compute Γt\Gamma_t, the variance of the generalized likelihood ration stochastic process at time $t$.

Value

A scalar value of the variance Γt\Gamma_t

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.


Given interim data, compute the response end-point summary

Description

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.

Usage

computeResponseSummary(interimData)

Arguments

interimData

The interim data for the clinical trial

Details

The result is a vector of counts and proportions

Value

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

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

## 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)

Given a design object, interim data and the current calendar time, conduct the interim analysis for the time

Description

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.

Usage

executeSP23Design(sp23DesignObject, data, currentCalendarTime)

Arguments

sp23DesignObject

A seamless phase II-III design object, typically one produced by the generateSP23Design function

data

The interim data, something akin to that produced by the function generateInterimData

currentCalendarTime

The current calendar time of the interim data. This better be one of the specified interim looks, or the function stops.

Details

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.

Value

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 H0H_0

pi1HatH0

estimate of the proportion of responders among control under H0H_0

pi0HatH1

estimate of the proportion of responders among control under H1H_1

pi1HatH1

estimate of the proportion of responders among control under H1H_1

glrRespH0

estimate of the generalized likelihood ratio statistic for response under H0H_0

glrRespH1

estimate of the generalized likelihood ratio statistic for response under H1H_1

glrSurvH0

estimate of the generalized likelihood ratio statistic for survival under H0H_0

glrSurvH1

estimate of the generalized likelihood ratio statistic for survival under H1H_1

alphaHat

the estimate of α\alpha

alphaHatH0

the estimate of α\alpha under H0H_0

alphaHatH1

the estimate of α\alpha under H1H_1

betaHat

the estimate of β\beta

betaHatH0

the estimate of β\beta under H0H_0

betaHatH1

the estimate of β\beta under H1H_1

gammaHat

the estimate of γ\gamma

gammaHatH0

the estimate of γ\gamma under H0H_0

gammaHatH1

the estimate of γ\gamma under H1H_1

hazard

the estimate of dd

v

the estimate of Γt\Gamma_t

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

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

## 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 specified design by simulation

Description

Explore a chosen design by generating simulated datasets and storing data from simulations for further analysis

Usage

exploreSP23Design(sp23Design, numberOfSimulations = 25, rngSeed = 12345,
showProgress = TRUE)

Arguments

sp23Design

A design object typically created by the function generateSP23Design

numberOfSimulations

The number of simulations to use, default 25

rngSeed

A seed for the random number generator for reproducibility

showProgress

A flag (default TRUE) to show progress or not

Details

This function is used while exploring the characteristics of a design. Results are accumulated and can be fed into analysis functions to inform choices.

Value

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 H0H_0

pi1HatH0

estimate of the proportion of responders among control under H0H_0

pi0HatH1

estimate of the proportion of responders among control under H1H_1

pi1HatH1

estimate of the proportion of responders among control under H1H_1

glrRespH0

estimate of the generalized likelihood ratio statistic for response under H0H_0

glrRespH1

estimate of the generalized likelihood ratio statistic for response under H1H_1

glrSurvH0

estimate of the generalized likelihood ratio statistic for survival under H0H_0

glrSurvH1

estimate of the generalized likelihood ratio statistic for survival under H1H_1

alphaHat

the estimate of α\alpha

alphaHatH0

the estimate of α\alpha under H0H_0

alphaHatH1

the estimate of α\alpha under H1H_1

betaHat

the estimate of β\beta

betaHatH0

the estimate of β\beta under H0H_0

betaHatH1

the estimate of β\beta under H1H_1

gammaHat

the estimate of γ\gamma

gammaHatH0

the estimate of γ\gamma under H0H_0

gammaHatH1

the estimate of γ\gamma under H1H_1

hazard

the estimate of dd

v

the estimate of Γt\Gamma_t

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

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

Lai, Tze Leung and Lavori, Philip W. and Shih, Mei-Chiung. Sequential Design of Phase II-III Cancer Trials, Statistics in Medicine, 2011, (submitted).

Examples

## 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)

A function to generate some clinical trial data according the joint model of response and survival for simulations

Description

The data is generated according to the model specified in the reference below, specifically,

λ(tY,Z)=λ0(t)exp(αY+βZ+γYZ)\lambda(t \mid Y,Z)=\lambda_0(t) \exp(\alpha Y + \beta Z + \gamma Y Z)

Usage

generateClinicalTrialData(nRec, nFUp, pi0, pi1, theta, lambda0, blockSize = 10)

Arguments

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 (α,β,γ)(\alpha, \beta, \gamma) of the joint response/survival model

lambda0

the baseline hazard rate

blockSize

the size of the blocks for randomization of the treatment/control; we use block randomization

Details

Generates data from an exponentail distribution according to the model and adhering to the recruitment goals for each calendar year

Value

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

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

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 for a clinical trial from a data set.

Description

Generate interim data at a given time from a dataset

Usage

generateInterimData(clinicalTrialDF, interimTime, administrativeCensoringTime)

Arguments

clinicalTrialDF

The data frame from which to generate the interim data. It is assumed that the variables entryTime, responseIndicator, treatmentIndicator and timeToEvent are present

interimTime

the interim time for which the data is to generated

administrativeCensoringTime

The administrative censoring time when the study concludes

Details

As it stands this function also is geared towards the simulation scenario. Needs to be cleaned up a bit.

Value

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

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

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

Description

Generate a seamless Phase II-III design object given some the true parameters and clinical trial parameters

Usage

generateSP23Design(trueParameters, trialParameters)

Arguments

trueParameters

A list constisting of several components including p0, the true probability of response under control, p1, the true probability of response under treatment, theta, a list of three items (α,β,γ)(\alpha,\beta,\gamma), baselineLambda, the base line hazard rate (constant for now), etaHyp, the hypothesized non-null hazard dd.

trialParameters

A list constisting of several components including numberRecruitedEachYear, a vector of recruitment numbers for each year, interimLookTime, the calendar interim look times, followupTime, the follow-up time, adminCensoringTime, the administrative censoring time, glrBoundarySidedness, either one or two-sided generalized likelihood ratio boundaries, default one-sided, typeIError, the type I error desired, type2Error, the type II error desired, used only for computing futility boundaries (only nominally used; need to clarify), epsTypeI, the fraction to spend in interim looks for the modified Haybittle-Peto boundaries, epsTypeII, the fraction to spend in interim looks for the modified Haybittle-Peto boundaries.

Details

Generates a design object that is used throughout the simulation or an actual analysis.

Value

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 exploreSP23Design.

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

See Also

exploreSP23Design and examples in the examples subdirectory of this package

Examples

## 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

Description

A utility function to compute the hessian of the generalized (conditional) partial likelihood ratio statistic

Usage

hessian(theta, pi, interimData)

Arguments

theta

The three-element vector (α,β,γ)(\alpha, \beta, \gamma)

pi

The two-element vector (π0,π1)(\pi_0, \pi_1)

interimData

The interim data frame

Details

Computes the hessian

Value

A 3×\times3 matrix of the hessian

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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

Description

Compute the response log-likelihood

Usage

loglik1(piVec, respSummary)

Arguments

piVec

The two-element vector of (π0,π1)(\pi_0, \pi_1)

respSummary

A vector consisting of the summary of data described in computeResponseSummary

Details

Computes the log-likelihood

Value

the log-likelihood

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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)

Description

Computes the constrained response log-likelihood (on the alternative)

Usage

loglik1GivenDelta(p, respSummary, delta = 0)

Arguments

p

The probability π0\pi_0

respSummary

A vector consisting of the summary of data described in computeResponseSummary

delta

The scalar value of the difference π1π0\pi_1-\pi_0

Details

Computes the constrained response log-likelihood (on the alternative)

Value

the (constrained) response log likelihood

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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

Description

Computes the survival log-likelihood

Usage

loglik2(theta, interimData)

Arguments

theta

the three-element vector of (α,β,γ)(\alpha, \beta, \gamma)

interimData

The interim data

Details

Computes the survival log-likelihood

Value

the survival log-likelihood

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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

Description

Computes the constrained survival log-likelihood

Usage

loglik2.repar0(xi, interimData, pi0, pi1, eta.hyp = 0)

Arguments

xi

the three-element vector of (a=eα,b=eβ,c=eγ)(a=e^\alpha, b=e^\beta, c=e^\gamma)

interimData

the interim data

pi0

the value π0\pi_0

pi1

the value π1\pi_1

eta.hyp

The hypothesised difference dd in the alternative hypothesis

Details

This uses the reparametrization above in terms of (a,b,c)(a,b,c) rather than (α,β,γ)(\alpha, \beta, \gamma )

Value

The constrained survival log-likelihood

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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

Description

Compute the modified Haybittle-Peto boundary

Usage

mHP.b(mu = c(0, 0), v = c(1, 2), alpha = 0.05, eps = 1/2, side = c("one", "two"))

Arguments

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 (one or two)

Details

Compute the modified Haybittle-Peto boundary

Value

the modified Haybittle-Peto boundary

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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

Description

Compute the modified Haybittle-Peto boundary for the final look

Usage

mHP.c(mu = c(0, 0, 0), v = c(1, 2, 3), b = 3, alpha = 0.05,
      eps = 1/2, side = c("one", "two"))

Arguments

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 mHP.b

alpha

The significance level desired

eps

The fraction of alpha to use

side

one-sided or two-sided (one or two)

Details

Compute the modified Haybittle-Peto boundary for the final look

Value

the modified Haybittle-Peto boundary for the final look

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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

Description

Perform an interim look in a seamless Phase II-III clinical trial

Usage

performInterimLook(k, trueParameters, trialParameters, glrBoundary,
                   interimData, interimLookHistoryDF, argRejectH0R)

Arguments

k

the index of the look

trueParameters

the true parameters, usually available in an object generated by generateSP23Design

trialParameters

the trial parameters, usually available in an object generated by generateSP23Design

glrBoundary

the generalized likelihood ratio boundaries, usually available in an object produced by generateSP23Design

interimData

the interim data

interimLookHistoryDF

the interim look history data frame matrix described in exploreSP23Design

argRejectH0R

A flag that indicates whether H0RH_0^R has been rejected in the previous look; A value of FALSE is used for first look.

Details

Perform an interim look in a seamless Phase II-III clinical trial

Value

a vector of named values described in exploreSP23Design, essentially providing a new row to the interim look history data frame

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

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

Description

Reset the design object so that counts and results are zeroed out

Usage

resetSP23Design(sp23Design)

Arguments

sp23Design

An object usually the result of generateSP23Design

Details

Reset the design object so that counts and results are zeroed out

Value

A new sp23Design object with counts and results zeroed out

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.

Examples

## 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)

A convenience function to reduce dimension by solving for one variable cc in terms of others aa, bb, dd

Description

A convenience function to reduce dimension by solving for one variable cc in terms of others aa, bb, dd

Usage

solveForCGivenABD(piVec, a, b, d)

Arguments

piVec

The two-element vector of (π0,π1)(\pi_0, \pi_1)

a

The value for aa

b

The value for bb

d

The value for dd

Details

Just solves the equation in closed form

Value

the value for cc

Author(s)

Mei-Chiung Shih, Balasubramanian Narasimhan, Pei He

References

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.