| plotRCDF.byArm | R Documentation |
Takes the output from the completeTrial.byArm function and generates a plot describing characteristics of the estimated distribution of the treatment arm-specific number of endpoints.
plotRCDF.byArm(
armLabel,
trtNames,
eventTimeFrame = NULL,
eventPPcohort = FALSE,
eventPriorRate,
eventPriorWeight,
xlim = NULL,
xlab = NULL,
ylab = NULL,
fileDir
)
armLabel |
a character string matching a treatment label in the |
trtNames |
a character vector of all treatment labels listed in the same order as in |
eventTimeFrame |
a time frame within which endpoints are counted, specified in weeks as |
eventPPcohort |
a logical value. If |
eventPriorRate |
a numeric vector of treatment arm-specific prior mean incidence rates for the endpoint, expressed as numbers of events per person-year at risk, matching the order of treatment arms in |
eventPriorWeight |
a numeric vector in which each value represents a weight (i.e., a separate scenario) assigned to the prior gamma distribution of the treatment arm-specific event rate at the time when 50% of the estimated person-time at risk in the given |
xlim |
a numeric vector of the form |
xlab |
a character string for the user-specified x-axis label. If |
ylab |
a character string for the user-specified y-axis label. If |
fileDir |
a character string specifying a path for the input directory |
None. The function is called solely for plot generation.
completeTrial.byArm and plotRCDF.pooledArms
arm <- rep(c("C3","T1","T2"), each=250)
schedule <- rbinom(length(arm), 1, 0.01)
entry <- rpois(length(arm), lambda=60)
entry <- entry - min(entry)
last_visit_dt <- entry + runif(length(arm), min=0, max=80)
event <- rbinom(length(arm), 1, 0.01)
dropout <- rbinom(length(arm), 1, 0.02)
dropout[event==1] <- 0
exit <- rep(NA, length(arm))
exit[event==1] <- last_visit_dt[event==1] + 5
exit[dropout==1] <- last_visit_dt[dropout==1] + 5
followup <- ifelse(event==1 | dropout==1, 0, 1)
interimData <- data.frame(arm=arm, schedule2=schedule, entry=entry, exit=exit,
last_visit_dt=last_visit_dt, event=event, dropout=dropout, complete=0, followup=followup)
weights <- c(0.2, 0.4, 0.6)
tmpdir <- tempfile('futility_example_'); dir.create(tmpdir)
for (j in 1:length(weights)){
completeTrial.byArm(interimData=interimData, nTrials=50,
trtNames=c("C3","T1","T2"),N=c(500,500,500),
enrollRatePeriod=24, eventPriorWeight=weights[j], eventPriorRate=c(0.06,0.03,0.03),
fuTime=80, visitSchedule=seq(0, 80, by=4), visitSchedule2=c(0,seq(from=8,to=80,by=12)),
saveDir=tmpdir, randomSeed=9)
}
pdf_file <- file.path(
tmpdir,
paste0('rcdf_byArm_arm=T1_',
'eventPriorRateC3=0.06_eventPriorRateT1=0.03_eventPriorRateT2=0.03.pdf')
)
pdf(file=pdf_file, width=6, height=5)
plotRCDF.byArm(armLabel="T1", trtNames=c("C3","T1","T2"), eventPriorRate=c(0.06,0.03,0.03),
eventPriorWeight=weights, fileDir=tmpdir)
dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.