decisionTimes: Extract the time since trial start to crossing a stopping...

View source: R/postMonitoring.R

decisionTimesR Documentation

Extract the time since trial start to crossing a stopping boundary or reaching the target number of events if no stopping boundary crossed in an event-driven 2-arm trial design

Description

Obtains times (in weeks) since trial initiation to crossing a harm, non-efficacy or efficacy boundary, or reaching the target number of events if no stopping boundary is crossed in an event-driven 2-arm trial design. The times are extracted from .RData files outputted by monitorTrial.

Usage

decisionTimes(
  monitorTrialFile,
  monitorTrialDir = NULL,
  saveFile = NULL,
  saveDir = monitorTrialDir
)

Arguments

monitorTrialFile

either a character vector specifying (multiple) .RData file(s) or a list of lists outputted by monitorTrial

monitorTrialDir

a character string specifying a path to the file(s) in monitorTrialFile if monitorTrialFile specifies file name(s)

saveFile

a character string optionally specifying an .RData file name storing the output (NULL by default)

saveDir

a character string optionally specifying the file path for saveFile (set to monitorTrialDir by default)

Value

A list (of the same length as monitorTrialFile) of numeric vectors of times. The order of the vectors matches the order of components in monitorTrialFile. The length of each vector equals the number of simulated trials in the corresponding output list from monitorTrial.

Examples

simData <- simTrial(N=c(1000, 1000), aveVE=c(0, 0.4),
                    VEmodel="half", vePeriods=c(1, 27, 79), enrollPeriod=78,
                    enrollPartial=13, enrollPartialRelRate=0.5, dropoutRate=0.05,
                    infecRate=0.6, fuTime=156,
                    visitSchedule=c(0, (13/3)*(1:4), seq(13*6/3, 156, by=13*2/3)),
                    missVaccProb=0.05, VEcutoffWeek=26, nTrials=5,
                    stage1=78, randomSeed=300)

monitorData <- monitorTrial(dataFile=simData, stage1=78, stage2=156,
                            harmMonitorRange=c(10,75), harmMonitorAlpha=0.05,
                            effCohort=list(timingCohort=list(lagTime=0),
                                           times=c(75, 150),
                                           timeUnit="counts",
                                           lagTime=0,
                                           estimand="cox",
                                           nullVE=0,
                                           nominalAlphas=c(0.001525, 0.024501)),
                            nonEffCohorts=list(timingCohort=list(lagTime=0),
                                               times=c(75, 150),
                                               timeUnit="counts",
                                               cohort1=list(lagTime=0,
                                                            estimand="cox",
                                                            nullVE=0.4,
                                                            nominalAlphas=c(0.001525, 0.024501))),
                            lowerVEnoneff=0, highVE=1, lowerVEuncPower=0,
                            alphaHigh=0.05, alphaUncPower=0.05,
                            verbose=FALSE)

times <- decisionTimes(list(monitorData))

## alternatively, to save the .RData output file (no '<-' needed):
## decisionTimes(list(monitorData), saveFile="decisionTimes.RData")


mjuraska/seqDesign documentation built on Dec. 14, 2022, 4:26 p.m.