tabEventAccrual: Tabulate event accrual over time since first enrollment

View source: R/eventAccrual.R

tabEventAccrualR Documentation

Tabulate event accrual over time since first enrollment

Description

Tabulates side-by-side different event totals and time periods since first enrollment required to accrue the event totals. The user specifies a vector of either event totals or time points since first enrollment, and tabEventAccrual completes the table.

Usage

tabEventAccrual(
  trialData,
  atEvents = NULL,
  atWeeks = NULL,
  prob = 0.5,
  lagTimeMITT = 0,
  lagTimePP = NULL,
  namePP = "pp1",
  na.ub = 0.2
)

Arguments

trialData

either a list of data frames from simTrial (i.e., component trialData from the output list) or a character string specifying a path to an .RData file outputted by simTrial

atEvents

a numeric vector specifying treatment-pooled event counts for which empirical quantiles of time-to-accrual shall be calculated

atWeeks

a numeric vector specifying time points (in weeks) since first enrollment for which empirical quantiles of treatment-pooled event counts shall be calculated

prob

a numeric value in (0, 1) specifying the probability at which the empirical quantiles across the simulated trials are computed (default is 0.5)

lagTimeMITT

a time point (in weeks). Only events with time-to-event lagTimeMITT are counted in the MITT column (default is 0).

lagTimePP

a time point (in weeks). If specified, only PP events with time-to-event lagTimePP are counted in the PP column.

namePP

a character string specifying the name of the column in each data frame in trialData which indicates membership in the PP cohort (default is "pp1")

na.ub

a numeric value specifying an upper limit on the fraction of simulated trials that do not reach a given event count in atEvents to still compute the empirical quantile of time-to-accrual. If the fraction of such trials exceeds na.ub, NA will be produced.

Details

All time variables use week as the unit of time.

If the user specifies atEvents, time periods since first enrollment are computed that are needed to observe atEvents MITT and atEvents PP events.

If the user specifies atWeeks, MITT and PP event totals are computed that are observed by atWeeks weeks since first enrollment.

The function inputs a large number of simulated trial data, and the computed variables (time periods or event totals) are empirical quantiles at probability prob of the sample distributions (of time periods or event totals). Medians are computed by default.

Value

A data frame (with at least two columns) of event totals and associated time periods since first enrollment required to accrue the event totals in the MITT cohort. If an PP cohort is specified (via lagTimePP), a third column is added.

See Also

simTrial

Examples

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

## user specifies MITT event totals
tabEventAccrual(simData$trialData, atEvents=seq(10, 100, by=10))

## user specifies MITT and PP event totals
tabEventAccrual(simData$trialData, atEvents=seq(10, 100, by=10), lagTimePP=6)

## user specifies time points since first enrollment
tabEventAccrual(simData$trialData, atWeeks=seq(52, 156, by=8), lagTimePP=6)


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