Title: | Simulating Oncology Trials using an Illness-Death Model |
---|---|
Description: | Based on the illness-death model a large number of clinical trials with oncology endpoints progression-free survival (PFS) and overall survival (OS) can be simulated, see Meller, Beyersmann and Rufibach (2019) <doi:10.1002/sim.8295>. The simulation set-up allows for random and event-driven censoring, an arbitrary number of treatment arms, staggered study entry and drop-out. Exponentially, Weibull and piecewise exponentially distributed survival times can be generated. The correlation between PFS and OS can be calculated. |
Authors: | Alexandra Erdmann [aut, cre], Kaspar Rufibach [aut], Holger Löwe [aut], Daniel Sabanés Bové [aut], F. Hoffmann-La Roche AG [cph, fnd], University of Ulm [cph, fnd] |
Maintainer: | Alexandra Erdmann <[email protected]> |
License: | Apache License 2.0 |
Version: | 0.1.0.9006 |
Built: | 2024-10-16 06:03:39 UTC |
Source: | https://github.com/insightsengineering/simIDM |
simIDM
PackagesimIDM
simulates a survival multistate model that jointly models PFS and OS.
Maintainer: Alexandra Erdmann [email protected]
Authors:
Kaspar Rufibach [email protected]
Holger Löwe [email protected]
Daniel Sabanés Bové [email protected]
Other contributors:
F. Hoffmann-La Roche AG [copyright holder, funder]
University of Ulm [copyright holder, funder]
Useful links:
Report bugs at https://github.com/insightsengineering/simIDM/issues
This function adds staggered study entry times to a simulated data set with illness-death model structure.
addStaggeredEntry(simData, N, accrualParam, accrualValue)
addStaggeredEntry(simData, N, accrualParam, accrualValue)
simData |
( |
N |
( |
accrualParam |
( |
accrualValue |
( |
This returns a data set containing a single simulated study containing accrual times,
i.e. staggered study entry.
This is a helper function of getSimulatedData()
.
simData <- data.frame( id = c(1, 1, 2, 3), from = c(0, 1, 0, 0), to = c(1, 2, "cens", 2), entry = c(0, 3, 0, 0), exit = c(3, 5.3, 5.6, 7.2), censTime = c(6.8, 6.8, 5.6, 9.4) ) addStaggeredEntry(simData, 3, accrualParam = "time", accrualValue = 5)
simData <- data.frame( id = c(1, 1, 2, 3), from = c(0, 1, 0, 0), to = c(1, 2, "cens", 2), entry = c(0, 3, 0, 0), exit = c(3, 5.3, 5.6, 7.2), censTime = c(6.8, 6.8, 5.6, 9.4) ) addStaggeredEntry(simData, 3, accrualParam = "time", accrualValue = 5)
We define an intervals vector to always start with 0, and contain unique ordered time points.
assert_intervals(x, y)
assert_intervals(x, y)
x |
what to check. |
y |
( |
Raises an error if x
is not an intervals vector starting with 0.
assert_intervals(c(0, 5, 7), 3)
assert_intervals(c(0, 5, 7), 3)
Assertion for Positive Number
assert_positive_number(x, zero_ok = FALSE)
assert_positive_number(x, zero_ok = FALSE)
x |
what to check. |
zero_ok |
( |
Raises an error if x
is not a single positive (or non-negative) number.
assert_positive_number(3.2) assert_positive_number(0, zero_ok = TRUE)
assert_positive_number(3.2) assert_positive_number(0, zero_ok = TRUE)
Average OS Hazard Ratio from Constant Transition Hazards
avgHRExpOS(transitionByArm, alpha = 0.5, upper = Inf)
avgHRExpOS(transitionByArm, alpha = 0.5, upper = Inf)
transitionByArm |
( |
alpha |
( |
upper |
( |
This returns the value of the average hazard ratio.
transitionTrt <- exponential_transition(h01 = 0.18, h02 = 0.06, h12 = 0.17) transitionCtl <- exponential_transition(h01 = 0.23, h02 = 0.07, h12 = 0.19) transitionList <- list(transitionCtl, transitionTrt) avgHRExpOS(transitionByArm = transitionList, alpha = 0.5, upper = 100)
transitionTrt <- exponential_transition(h01 = 0.18, h02 = 0.06, h12 = 0.17) transitionCtl <- exponential_transition(h01 = 0.23, h02 = 0.07, h12 = 0.19) transitionList <- list(transitionCtl, transitionTrt) avgHRExpOS(transitionByArm = transitionList, alpha = 0.5, upper = 100)
avgHRExpOS()
It is an integrand of the form OS hazard function with intensities h01, h02, h12 at time point t multiplied with a weighted product of the two OS Survival functions at t (one for intensities h0 and one for h1).
avgHRIntegExpOS(x, h01, h02, h12, h0, h1, alpha)
avgHRIntegExpOS(x, h01, h02, h12, h0, h1, alpha)
x |
( |
h01 |
(positive |
h02 |
(positive |
h12 |
(positive |
h0 |
( |
h1 |
( |
alpha |
( |
This returns the value of the integrand used to calculate
the average hazard ratio for constant transition hazards, see avgHRExpOS()
.
h0 <- list(h01 = 0.18, h02 = 0.06, h12 = 0.17) h1 <- list(h01 = 0.23, h02 = 0.07, h12 = 0.19) avgHRIntegExpOS(x = 5, h01 = 0.2, h02 = 0.5, h12 = 0.7, h0 = h0, h1 = h1, alpha = 0.5)
h0 <- list(h01 = 0.18, h02 = 0.06, h12 = 0.17) h1 <- list(h01 = 0.23, h02 = 0.07, h12 = 0.19) avgHRIntegExpOS(x = 5, h01 = 0.2, h02 = 0.5, h12 = 0.7, h0 = h0, h1 = h1, alpha = 0.5)
This function censors a study after a pre-specified number of events occurred.
censoringByNumberEvents(data, eventNum, typeEvent)
censoringByNumberEvents(data, eventNum, typeEvent)
data |
( |
eventNum |
( |
typeEvent |
( |
This function returns a data set that is censored after eventNum
of
typeEvent
-events occurred.
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 7) ) simStudyWide <- getDatasetWideFormat(simStudy) censoringByNumberEvents(data = simStudyWide, eventNum = 20, typeEvent = "PFS")
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 7) ) simStudyWide <- getDatasetWideFormat(simStudy) censoringByNumberEvents(data = simStudyWide, eventNum = 20, typeEvent = "PFS")
Correlation of PFS and OS event times for data from the IDM
corPFSOS( data, transition, bootstrap = TRUE, bootstrap_n = 100, conf_level = 0.95 )
corPFSOS( data, transition, bootstrap = TRUE, bootstrap_n = 100, conf_level = 0.95 )
data |
( |
transition |
( |
bootstrap |
( |
bootstrap_n |
( |
conf_level |
( |
The correlation of PFS and OS.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) data <- getClinicalTrials( nRep = 1, nPat = c(100), seed = 1234, datType = "1rowTransition", transitionByArm = list(transition), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) )[[1]] corPFSOS(data, transition = exponential_transition(), bootstrap = FALSE) ## Not run: corPFSOS(data, transition = exponential_transition(), bootstrap = TRUE) ## End(Not run)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) data <- getClinicalTrials( nRep = 1, nPat = c(100), seed = 1234, datType = "1rowTransition", transitionByArm = list(transition), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) )[[1]] corPFSOS(data, transition = exponential_transition(), bootstrap = FALSE) ## Not run: corPFSOS(data, transition = exponential_transition(), bootstrap = TRUE) ## End(Not run)
Correlation of PFS and OS event times for Different Transition Models
corTrans(transition)
corTrans(transition)
transition |
( |
The correlation of PFS and OS.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) corTrans(transition)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) corTrans(transition)
This function computes four types of empirical significance — PFS, OS, at-least (significant in at least one of PFS/OS), and joint (significant in both PFS and OS) — using the log-rank test. Empirical significance is calculated as the proportion of significant results in simulated trials, each ending when a set number of PFS/OS events occur. Critical values for PFS and OS test significance must be specified. If trials simulate equal transition hazards across groups (H0), empirical significance estimates type I error; if they simulate differing transition hazards (H1), it estimates power.
empSignificant(simTrials, criticalPFS, criticalOS, eventNumPFS, eventNumOS)
empSignificant(simTrials, criticalPFS, criticalOS, eventNumPFS, eventNumOS)
simTrials |
( |
criticalPFS |
(positive |
criticalOS |
(positive |
eventNumPFS |
( |
eventNumOS |
( |
This returns values of four measures of empirical significance.
transition1 <- exponential_transition(h01 = 0.06, h02 = 0.3, h12 = 0.3) transition2 <- exponential_transition(h01 = 0.1, h02 = 0.4, h12 = 0.3) simTrials <- getClinicalTrials( nRep = 50, nPat = c(800, 800), seed = 1234, datType = "1rowPatient", transitionByArm = list(transition1, transition2), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) ) empSignificant( simTrials = simTrials, criticalPFS = 2.4, criticalOS = 2.2, eventNumPFS = 300, eventNumOS = 500 )
transition1 <- exponential_transition(h01 = 0.06, h02 = 0.3, h12 = 0.3) transition2 <- exponential_transition(h01 = 0.1, h02 = 0.4, h12 = 0.3) simTrials <- getClinicalTrials( nRep = 50, nPat = c(800, 800), seed = 1234, datType = "1rowPatient", transitionByArm = list(transition1, transition2), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) ) empSignificant( simTrials = simTrials, criticalPFS = 2.4, criticalOS = 2.2, eventNumPFS = 300, eventNumOS = 500 )
Estimate Parameters of the Multistate Model Using Clinical Trial Data
estimateParams(data, transition)
estimateParams(data, transition)
data |
( |
transition |
( |
This function estimates parameters for transition models using clinical trial data.
The transition
object can be initialized with starting values for parameter estimation.
It uses stats::optim()
to optimize the parameters.
Returns a TransitionParameters
object with the estimated parameters.
transition <- exponential_transition(h01 = 2, h02 = 1.4, h12 = 1.6) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.3, time = 12), accrual = list(param = "time", value = 1) ) # Initialize transition with desired starting values for optimization: transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) estimate <- estimateParams(simData, transition)
transition <- exponential_transition(h01 = 2, h02 = 1.4, h12 = 1.6) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.3, time = 12), accrual = list(param = "time", value = 1) ) # Initialize transition with desired starting values for optimization: transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) estimate <- estimateParams(simData, transition)
OS Hazard Function from Constant Transition Hazards
ExpHazOS(t, h01, h02, h12)
ExpHazOS(t, h01, h02, h12)
t |
( |
h01 |
(positive |
h02 |
(positive |
h12 |
(positive |
This returns the value of the OS hazard function at time t.
ExpHazOS(c(1:5), 0.2, 1.1, 0.8)
ExpHazOS(c(1:5), 0.2, 1.1, 0.8)
This creates a list with class TransitionParameters
containing
hazards, time intervals and Weibull rates for exponential event times
in an illness-death model.
exponential_transition(h01 = 1, h02 = 1, h12 = 1)
exponential_transition(h01 = 1, h02 = 1, h12 = 1)
h01 |
(positive |
h02 |
(positive |
h12 |
(positive |
List with elements hazards
, intervals
, weibull_rates
and family
(exponential).
exponential_transition(1, 1.6, 0.3)
exponential_transition(1, 1.6, 0.3)
Quantile function for OS survival function induced by an illness-death model
ExpQuantOS(q = 1/2, h01, h02, h12)
ExpQuantOS(q = 1/2, h01, h02, h12)
q |
( |
h01 |
( |
h02 |
( |
h12 |
( |
This returns the time(s) t such that the OS survival function at t equals q.
ExpQuantOS(1 / 2, 0.2, 0.5, 2.1)
ExpQuantOS(1 / 2, 0.2, 0.5, 2.1)
OS Survival Function from Constant Transition Hazards
ExpSurvOS(t, h01, h02, h12)
ExpSurvOS(t, h01, h02, h12)
t |
( |
h01 |
(positive |
h02 |
(positive |
h12 |
(positive |
This returns the value of OS survival function at time t.
ExpSurvOS(c(1:5), 0.2, 0.4, 0.1)
ExpSurvOS(c(1:5), 0.2, 0.4, 0.1)
PFS Survival Function from Constant Transition Hazards
ExpSurvPFS(t, h01, h02)
ExpSurvPFS(t, h01, h02)
t |
( |
h01 |
(positive |
h02 |
(positive |
This returns the value of PFS survival function at time t.
ExpSurvPFS(c(1:5), 0.2, 0.4)
ExpSurvPFS(c(1:5), 0.2, 0.4)
Helper Function for Computing E(OS^2)
expvalOSInteg(x, transition)
expvalOSInteg(x, transition)
x |
( |
transition |
( |
Numeric results of the integrand used to calculate E(OS^2).
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) expvalOSInteg(0.4, transition)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) expvalOSInteg(0.4, transition)
Helper Function for Computing E(PFS^2)
expvalPFSInteg(x, transition)
expvalPFSInteg(x, transition)
x |
( |
transition |
( |
Numeric results of the integrand used to calculate E(PFS^2).
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) expvalPFSInteg(0.4, transition)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) expvalPFSInteg(0.4, transition)
censoringByNumberEvents
Helper function for censoringByNumberEvents
getCensoredData(time, event, data)
getCensoredData(time, event, data)
time |
( |
event |
( |
data |
( |
This function returns a data frame with columns: event time, censoring indicator, event indicator and event time in calendar time.
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 7) ) simStudyWide <- getDatasetWideFormat(simStudy) simStudyWide$censTimeInd <- 5 - simStudyWide$recruitTime NotRecruited <- simStudyWide$id[simStudyWide$censTimeInd < 0] censoredData <- simStudyWide[!(simStudyWide$id %in% NotRecruited), ] getCensoredData(time = censoredData$OStime, event = censoredData$OSevent, data = censoredData)
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 7) ) simStudyWide <- getDatasetWideFormat(simStudy) simStudyWide$censTimeInd <- 5 - simStudyWide$recruitTime NotRecruited <- simStudyWide$id[simStudyWide$censTimeInd < 0] censoredData <- simStudyWide[!(simStudyWide$id %in% NotRecruited), ] getCensoredData(time = censoredData$OStime, event = censoredData$OSevent, data = censoredData)
Simulation of a Large Number of Oncology Clinical Trials
getClinicalTrials(nRep, ..., seed = 1234, datType = "1rowTransition")
getClinicalTrials(nRep, ..., seed = 1234, datType = "1rowTransition")
nRep |
( |
... |
parameters transferred to |
seed |
( |
datType |
( |
This function returns a list with nRep
simulated data sets in the format specified by datType
.
See getDatasetWideFormat()
getOneClinicalTrial()
for details.
transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7) getClinicalTrials( nRep = 10, nPat = c(20, 20), seed = 1234, datType = "1rowTransition", transitionByArm = list(transition1, transition2), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) )
transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7) getClinicalTrials( nRep = 10, nPat = c(20, 20), seed = 1234, datType = "1rowTransition", transitionByArm = list(transition1, transition2), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) )
Conversion of a Data Set from One Row per Transition to One Row per Patient
getDatasetWideFormat(data)
getDatasetWideFormat(data)
data |
( |
The output data set contains the following columns:
id (integer
): patient id.
trt integer
): treatment id.
PFStime (numeric
): event time of PFS event.
CensoredPFS (logical
): censoring indicator for PFS event.
PFSevent (logical
): event indicator for PFS event.
OStime (numeric
): event time of OS event.
CensoredOS (logical
): censoring indicator for OS event.
OSevent (logical
): event indicator for OS event.
recruitTime (numeric
): time of recruitment.
OStimeCal (numeric
): OS event time at calendar time scale.
PFStimeCal (numeric
): PFS event time at calendar time scale.
This function returns a data set with one row per patient and endpoints PFS and OS.
transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7) transition3 <- exponential_transition(h01 = 1.1, h02 = 1, h12 = 1.5) simData <- getOneClinicalTrial( nPat = c(30, 20, 30), transitionByArm = list(transition1, transition2, transition3), dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) ) getDatasetWideFormat(simData)
transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7) transition3 <- exponential_transition(h01 = 1.1, h02 = 1, h12 = 1.5) simData <- getOneClinicalTrial( nPat = c(30, 20, 30), transitionByArm = list(transition1, transition2, transition3), dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) ) getDatasetWideFormat(simData)
Number of recruited/censored/ongoing Patients.
getEventsAll(data, t)
getEventsAll(data, t)
data |
( |
t |
( |
This function returns number of recruited patients, number of censored and number of patients under observations.
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.6, time = 10), accrual = list(param = "time", value = 0) ) simStudyWide <- getDatasetWideFormat(simStudy) getEventsAll(data = simStudyWide, t = 1.5)
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.6, time = 10), accrual = list(param = "time", value = 0) ) simStudyWide <- getDatasetWideFormat(simStudy) getEventsAll(data = simStudyWide, t = 1.5)
Retrieve Initial Parameter Vectors for Likelihood Maximization
getInit(transition) ## S3 method for class 'ExponentialTransition' getInit(transition) ## S3 method for class 'WeibullTransition' getInit(transition)
getInit(transition) ## S3 method for class 'ExponentialTransition' getInit(transition) ## S3 method for class 'WeibullTransition' getInit(transition)
transition |
( |
The numeric vector of initial parameters for likelihood maximization.
getInit(ExponentialTransition)
: for the Exponential Transition Model
getInit(WeibullTransition)
: for the Weibull Transition Model
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) getInit(transition) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) getInit(transition) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) getInit(transition)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) getInit(transition) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) getInit(transition) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) getInit(transition)
trackEventsPerTrial
Helper Function for trackEventsPerTrial
getNumberEvents(event, time, t)
getNumberEvents(event, time, t)
event |
( |
time |
( |
t |
( |
This function returns the number of events occurred until time t.
event <- c(0, 1, 1, 1, 0) time <- c(3, 3.4, 5, 6, 5.5) getNumberEvents(event = event, time = time, t = 5)
event <- c(0, 1, 1, 1, 0) time <- c(3, 3.4, 5, 6, 5.5) getNumberEvents(event = event, time = time, t = 5)
This function creates a data set with a single simulated oncology clinical trial with one row per transition based on an illness-death model. Studies with an arbitrary number of treatment arms are possible.
getOneClinicalTrial( nPat, transitionByArm, dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) )
getOneClinicalTrial( nPat, transitionByArm, dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) )
nPat |
( |
transitionByArm |
( |
dropout |
dropout ( |
accrual |
accrual ( |
This returns a data frame with one simulated clinical trial and multiple treatment arms.
See getSimulatedData()
for the explanation of the columns. The column trt
contains the treatment indicator.
This is a helper function of getClinicalTrials()
.
transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7) transition3 <- exponential_transition(h01 = 1.1, h02 = 1, h12 = 1.5) getOneClinicalTrial( nPat = c(30, 20, 30), transitionByArm = list(transition1, transition2, transition3), dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) )
transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7) transition3 <- exponential_transition(h01 = 1.1, h02 = 1, h12 = 1.5) getOneClinicalTrial( nPat = c(30, 20, 30), transitionByArm = list(transition1, transition2, transition3), dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) )
This function creates transition entry and exit times from the intermediate state to the absorbing state for an existing data frame containing the exit times out of the initial state.
getOneToTwoRows(simDataOne, transition)
getOneToTwoRows(simDataOne, transition)
simDataOne |
( |
transition |
( |
This returns a data frame with one row per patient for the second transition,
i.e. the transition out of the intermediate
state. This is a helper function of getSimulatedData()
.
simDataOne <- data.frame( id = c(1:3), to = c(1, 1, 1), from = c(0, 0, 0), entry = c(0, 0, 0), exit = c(3, 5.6, 7.2), censTime = c(6.8, 5.9, 9.4) ) transition <- exponential_transition(1, 1.6, 0.3) getOneToTwoRows(simDataOne, transition)
simDataOne <- data.frame( id = c(1:3), to = c(1, 1, 1), from = c(0, 0, 0), entry = c(0, 0, 0), exit = c(3, 5.6, 7.2), censTime = c(6.8, 5.9, 9.4) ) transition <- exponential_transition(1, 1.6, 0.3) getOneToTwoRows(simDataOne, transition)
This returns event times with a distribution resulting from piece-wise constant hazards using the inversion method.
getPCWDistr(U, haz, pw, t_0)
getPCWDistr(U, haz, pw, t_0)
U |
( |
haz |
( |
pw |
( |
t_0 |
( |
This returns a vector with event times.
getPCWDistr(U = runif(3), haz = c(1.1, 0.5, 0.4), pw = c(0, 7, 10), t_0 = c(0, 1, 4.2))
getPCWDistr(U = runif(3), haz = c(1.1, 0.5, 0.4), pw = c(0, 7, 10), t_0 = c(0, 1, 4.2))
This returns piecewise constant hazard values at specified time points.
getPWCHazard(haz, pw, x)
getPWCHazard(haz, pw, x)
haz |
( |
pw |
( |
x |
( |
Hazard values at input time-points.
getPWCHazard(c(1, 1.2, 1.4), c(0, 2, 3), c(1, 4, 6))
getPWCHazard(c(1, 1.2, 1.4), c(0, 2, 3), c(1, 4, 6))
Format Results of Parameter Estimation for Different Transition Models
getResults(transition, res) ## S3 method for class 'ExponentialTransition' getResults(transition, res) ## S3 method for class 'WeibullTransition' getResults(transition, res)
getResults(transition, res) ## S3 method for class 'ExponentialTransition' getResults(transition, res) ## S3 method for class 'WeibullTransition' getResults(transition, res)
transition |
( |
res |
( |
Returns a TransitionParameters
object with parameter estimates.
getResults(ExponentialTransition)
: for the Exponential Transition Model
getResults(WeibullTransition)
: for the Weibull Transition Model
results <- c(1.2, 1.5, 1.6) getResults(exponential_transition(), results) results <- c(1.2, 1.5, 1.6) getResults(exponential_transition(), results) results <- c(1.2, 1.5, 1.6, 2, 2.5, 1) getResults(weibull_transition(), results)
results <- c(1.2, 1.5, 1.6) getResults(exponential_transition(), results) results <- c(1.2, 1.5, 1.6) getResults(exponential_transition(), results) results <- c(1.2, 1.5, 1.6, 2, 2.5, 1) getResults(weibull_transition(), results)
This function creates a single simulated data set for a single treatment arm. It simulates data from an illness-death model with one row per transition and subject.
getSimulatedData( N, transition = exponential_transition(h01 = 1, h02 = 1, h12 = 1), dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) )
getSimulatedData( N, transition = exponential_transition(h01 = 1, h02 = 1, h12 = 1), dropout = list(rate = 0, time = 12), accrual = list(param = "time", value = 0) )
N |
( |
transition |
( |
dropout |
( |
accrual |
( |
The output data set contains the following columns:
id (integer
): patient id.
from (numeric
): starting state of the transition.
to (character
): final state of the transition.
entry (numeric
): entry time of the transition on the individual time scale.
exit (numeric
): exit time of the transition on the individual time scale.
entryAct (numeric
): entry time of the transition on study time scale.
exitAct (numeric
): exit time of the transition on study time scale.
censAct (numeric
): censoring time of the individual on study time scale.
This returns a data frame with one row per transition per individual.
getSimulatedData( N = 10, transition = exponential_transition(h01 = 1, h02 = 1.5, h12 = 1), dropout = list(rate = 0.3, time = 1), accrual = list(param = "time", value = 5) )
getSimulatedData( N = 10, transition = exponential_transition(h01 = 1, h02 = 1.5, h12 = 1), dropout = list(rate = 0.3, time = 1), accrual = list(param = "time", value = 5) )
This returns the sum of two piecewise constant hazards per interval.
getSumPCW(haz1, haz2, pw1, pw2)
getSumPCW(haz1, haz2, pw1, pw2)
haz1 |
( |
haz2 |
( |
pw1 |
( |
pw2 |
( |
List with elements hazards
and intervals
for the sum of two piecewise constant hazards.
getSumPCW(c(1.2, 0.3, 0.6), c(1.2, 0.7, 1), c(0, 8, 9), c(0, 1, 4))
getSumPCW(c(1.2, 0.3, 0.6), c(1.2, 0.7, 1), c(0, 8, 9), c(0, 1, 4))
Generate the Target Function for Optimization
getTarget(transition) ## S3 method for class 'ExponentialTransition' getTarget(transition) ## S3 method for class 'WeibullTransition' getTarget(transition)
getTarget(transition) ## S3 method for class 'ExponentialTransition' getTarget(transition) ## S3 method for class 'WeibullTransition' getTarget(transition)
transition |
( |
This function creates a target function for optimization, computing the negative log-likelihood for given parameters, data, and transition model type.
Function that calculates the negative log-likelihood for the given parameters.
getTarget(ExponentialTransition)
: for the Exponential Transition Model
getTarget(WeibullTransition)
: for the Weibull Transition Model
transition <- exponential_transition(2, 1.3, 0.8) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) params <- c(1.2, 1.5, 1.6) # For ExponentialTransition data <- prepareData(simData) transition <- exponential_transition() fun <- getTarget(transition) fun(params, data) transition <- exponential_transition(2, 1.3, 0.8) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) params <- c(1.2, 1.5, 1.6) data <- prepareData(simData) transition <- exponential_transition() target <- getTarget(transition) target(params, data) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) params <- c(1.2, 1.5, 1.6, 0.8, 1.3, 1.1) data <- prepareData(simData) transition <- weibull_transition() target <- getTarget(transition) target(params, data)
transition <- exponential_transition(2, 1.3, 0.8) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) params <- c(1.2, 1.5, 1.6) # For ExponentialTransition data <- prepareData(simData) transition <- exponential_transition() fun <- getTarget(transition) fun(params, data) transition <- exponential_transition(2, 1.3, 0.8) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) params <- c(1.2, 1.5, 1.6) data <- prepareData(simData) transition <- exponential_transition() target <- getTarget(transition) target(params, data) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) params <- c(1.2, 1.5, 1.6, 0.8, 1.3, 1.1) data <- prepareData(simData) transition <- weibull_transition() target <- getTarget(transition) target(params, data)
This returns the study time-point by which a specified number of events (PFS or OS) occurred.
getTimePoint(data, eventNum, typeEvent, byArm = FALSE)
getTimePoint(data, eventNum, typeEvent, byArm = FALSE)
data |
( |
eventNum |
( |
typeEvent |
( |
byArm |
( |
This returns the time-point by which eventNum
of typeEvent
-events occurred.
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 0) ) simStudyWide <- getDatasetWideFormat(simStudy) getTimePoint(simStudyWide, eventNum = 10, typeEvent = "OS", byArm = FALSE)
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 0) ) simStudyWide <- getDatasetWideFormat(simStudy) getTimePoint(simStudyWide, eventNum = 10, typeEvent = "OS", byArm = FALSE)
This returns event times with a distribution resulting from the sum of two Weibull distributed random variables using the inversion method.
getWaitTimeSum(U, haz1, haz2, p1, p2, entry)
getWaitTimeSum(U, haz1, haz2, p1, p2, entry)
U |
( |
haz1 |
(positive |
haz2 |
(positive |
p1 |
(positive |
p2 |
(positive |
entry |
( |
This returns a vector with event times.
getWaitTimeSum(U = c(0.4, 0.5), haz1 = 0.8, haz2 = 1, p1 = 1.1, p2 = 1.5, entry = c(0, 0))
getWaitTimeSum(U = c(0.4, 0.5), haz1 = 0.8, haz2 = 1, p1 = 1.1, p2 = 1.5, entry = c(0, 0))
Hazard Function for Different Transition Models
haz(transition, t, trans) ## S3 method for class 'ExponentialTransition' haz(transition, t, trans) ## S3 method for class 'WeibullTransition' haz(transition, t, trans) ## S3 method for class 'PWCTransition' haz(transition, t, trans)
haz(transition, t, trans) ## S3 method for class 'ExponentialTransition' haz(transition, t, trans) ## S3 method for class 'WeibullTransition' haz(transition, t, trans) ## S3 method for class 'PWCTransition' haz(transition, t, trans)
transition |
( |
t |
( |
trans |
( |
The transition types are:
1
: Transition from state 0 (stable) to 1 (progression).
2
: Transition from state 0 (stable) to 2 (death).
3
: Transition from state 1 (progression) to 2 (death).
The hazard rate for the specified transition and time.
haz(ExponentialTransition)
: for an exponential transition model.
haz(WeibullTransition)
: for the Weibull transition model.
haz(PWCTransition)
: for the piecewise constant transition model.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) haz(transition, 0.4, 2) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) haz(transition, 0.4, 2) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) haz(transition, 0.4, 2) transition <- piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) ) haz(transition, 6, 2)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) haz(transition, 0.4, 2) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) haz(transition, 0.4, 2) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) haz(transition, 0.4, 2) transition <- piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) ) haz(transition, 6, 2)
Probability of Remaining in Progression Between Two Time Points for Different Transition Models
log_p11(transition, s, t)
log_p11(transition, s, t)
transition |
( |
s |
( |
t |
( |
This returns the natural logarithm of the probability of remaining in progression (state 1) between two time points, conditional on being in state 1 at the lower time point.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) log_p11(transition, 1, 3)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) log_p11(transition, 1, 3)
This function evaluates the significance of either PFS or OS endpoints in a trial, based on a pre-specified critical value.
logRankTest(data, typeEvent = c("PFS", "OS"), critical)
logRankTest(data, typeEvent = c("PFS", "OS"), critical)
data |
( |
typeEvent |
( |
critical |
(positive |
Logical value indicating log-rank test significance.
transition1 <- exponential_transition(h01 = 0.06, h02 = 0.3, h12 = 0.3) transition2 <- exponential_transition(h01 = 0.1, h02 = 0.4, h12 = 0.3) simTrial <- getClinicalTrials( nRep = 1, nPat = c(800, 800), seed = 1234, datType = "1rowPatient", transitionByArm = list(transition1, transition2), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) )[[1]] logRankTest(data = simTrial, typeEvent = "OS", critical = 3.4)
transition1 <- exponential_transition(h01 = 0.06, h02 = 0.3, h12 = 0.3) transition2 <- exponential_transition(h01 = 0.1, h02 = 0.4, h12 = 0.3) simTrial <- getClinicalTrials( nRep = 1, nPat = c(800, 800), seed = 1234, datType = "1rowPatient", transitionByArm = list(transition1, transition2), dropout = list(rate = 0.5, time = 12), accrual = list(param = "intensity", value = 7) )[[1]] logRankTest(data = simTrial, typeEvent = "OS", critical = 3.4)
Compute the Negative Log-Likelihood for a Given Data Set and Transition Model
negLogLik(transition, data)
negLogLik(transition, data)
transition |
( |
data |
( |
Calculates the negative log-likelihood for a given data set and transition model. It uses the hazard and survival functions specific to the transition model.
The value of the negative log-likelihood.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) negLogLik(transition, prepareData(simData))
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) negLogLik(transition, prepareData(simData))
This returns an event time with a distribution resulting from piece-wise constant hazards using the inversion method.
PCWInversionMethod(haz, pw, LogU)
PCWInversionMethod(haz, pw, LogU)
haz |
( |
pw |
( |
LogU |
( |
This returns one single event time.
PCWInversionMethod(haz = c(1.1, 0.5, 0.4), pw = c(0, 7, 10), LogU = log(1 - runif(1)))
PCWInversionMethod(haz = c(1.1, 0.5, 0.4), pw = c(0, 7, 10), LogU = log(1 - runif(1)))
This creates a list with class TransitionParameters
containing
hazards, time intervals and Weibull rates for piecewise exponential event times
in an illness-death model.
piecewise_exponential(h01, h02, h12, pw01, pw02, pw12)
piecewise_exponential(h01, h02, h12, pw01, pw02, pw12)
h01 |
( |
h02 |
( |
h12 |
( |
pw01 |
( |
pw02 |
( |
pw12 |
( |
List with elements hazards
, intervals
, weibull_rates
and family
(piecewise exponential).
piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) )
piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) )
Preparation of a Data Set to Compute Log-likelihood
prepareData(data)
prepareData(data)
data |
( |
The output data set contains the following columns:
id (integer
): patient id.
from (integer
): start event state.
to (integer
): end event state.
trans (integer
): transition (1, 2 or 3) identifier
1
: Transition from state 0 (stable) to 1 (progression).
2
: Transition from state 0 (stable) to 2 (death).
3
: Transition from state 1 (progression) to 2 (death).
entry (numeric
): time at which the patient begins to be at risk for the transition.
exit (numeric
): time at which the patient ends to be at risk for the transition.
status (logical
): event indicator for the transition.
This function returns a data set with one row per patient and transition, when the patient is at risk.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) prepareData(simData)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) simData <- getOneClinicalTrial( nPat = c(30), transitionByArm = list(transition), dropout = list(rate = 0.8, time = 12), accrual = list(param = "time", value = 1) ) prepareData(simData)
Cumulative Hazard for Piecewise Constant Hazards
pwA(t, haz, pw)
pwA(t, haz, pw)
t |
( |
haz |
( |
pw |
( |
This returns the value of cumulative hazard at time t.
pwA(1:5, c(0.5, 0.9), c(0, 4))
pwA(1:5, c(0.5, 0.9), c(0, 4))
OS Survival Function from Piecewise Constant Hazards
PWCsurvOS(t, h01, h02, h12, pw01, pw02, pw12)
PWCsurvOS(t, h01, h02, h12, pw01, pw02, pw12)
t |
( |
h01 |
( |
h02 |
( |
h12 |
( |
pw01 |
( |
pw02 |
( |
pw12 |
( |
This returns the value of OS survival function at time t.
PWCsurvOS(1:5, c(0.3, 0.5), c(0.5, 0.8), c(0.7, 1), c(0, 4), c(0, 8), c(0, 3))
PWCsurvOS(1:5, c(0.3, 0.5), c(0.5, 0.8), c(0.7, 1), c(0, 4), c(0, 8), c(0, 3))
PFS Survival Function from Piecewise Constant Hazards
PWCsurvPFS(t, h01, h02, pw01, pw02)
PWCsurvPFS(t, h01, h02, pw01, pw02)
t |
( |
h01 |
( |
h02 |
( |
pw01 |
( |
pw02 |
( |
This returns the value of PFS survival function at time t.
PWCsurvPFS(1:5, c(0.3, 0.5), c(0.5, 0.8), c(0, 4), c(0, 8))
PWCsurvPFS(1:5, c(0.3, 0.5), c(0.5, 0.8), c(0, 4), c(0, 8))
OS Survival Function for Different Transition Models
survOS(transition, t) ## S3 method for class 'ExponentialTransition' survOS(transition, t) ## S3 method for class 'WeibullTransition' survOS(transition, t) ## S3 method for class 'PWCTransition' survOS(transition, t)
survOS(transition, t) ## S3 method for class 'ExponentialTransition' survOS(transition, t) ## S3 method for class 'WeibullTransition' survOS(transition, t) ## S3 method for class 'PWCTransition' survOS(transition, t)
transition |
( |
t |
( |
The value of the survival function for the specified transition and time.
survOS(ExponentialTransition)
: Survival Function for an exponential transition model.
survOS(WeibullTransition)
: Survival Function for a Weibull transition model.
survOS(PWCTransition)
: Survival Function for a piecewise constant transition model.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survOS(transition, 0.4) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survOS(transition, 0.4) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) survOS(transition, 0.4) transition <- piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) ) survOS(transition, 0.4)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survOS(transition, 0.4) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survOS(transition, 0.4) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) survOS(transition, 0.4) transition <- piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) ) survOS(transition, 0.4)
PFS Survival Function for Different Transition Models
survPFS(transition, t) ## S3 method for class 'ExponentialTransition' survPFS(transition, t) ## S3 method for class 'WeibullTransition' survPFS(transition, t) ## S3 method for class 'PWCTransition' survPFS(transition, t)
survPFS(transition, t) ## S3 method for class 'ExponentialTransition' survPFS(transition, t) ## S3 method for class 'WeibullTransition' survPFS(transition, t) ## S3 method for class 'PWCTransition' survPFS(transition, t)
transition |
( |
t |
( |
The value of the survival function for the specified transition and time.
survPFS(ExponentialTransition)
: Survival Function for an exponential transition model.
survPFS(WeibullTransition)
: Survival Function for a Weibull transition model.
survPFS(PWCTransition)
: Survival Function for a piecewise constant transition model.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survPFS(transition, 0.4) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survPFS(transition, 0.4) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) survPFS(transition, 0.4) transition <- piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) ) survPFS(transition, 0.4)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survPFS(transition, 0.4) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survPFS(transition, 0.4) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) survPFS(transition, 0.4) transition <- piecewise_exponential( h01 = c(1, 1, 1), h02 = c(1.5, 0.5, 1), h12 = c(1, 1, 1), pw01 = c(0, 3, 8), pw02 = c(0, 6, 7), pw12 = c(0, 8, 9) ) survPFS(transition, 0.4)
Survival Function of the Product PFS*OS for Different Transition Models
survPFSOS(t, transition)
survPFSOS(t, transition)
t |
( |
transition |
( |
This returns the value of PFS*OS survival function at time t.
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survPFSOS(0.4, transition)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survPFSOS(0.4, transition)
Survival Function for Different Transition Models
survTrans(transition, t, trans) ## S3 method for class 'ExponentialTransition' survTrans(transition, t, trans) ## S3 method for class 'WeibullTransition' survTrans(transition, t, trans)
survTrans(transition, t, trans) ## S3 method for class 'ExponentialTransition' survTrans(transition, t, trans) ## S3 method for class 'WeibullTransition' survTrans(transition, t, trans)
transition |
( |
t |
( |
trans |
( |
The survival probability for the specified transition and time.
survTrans(ExponentialTransition)
: for the Exponential Transition Model
survTrans(WeibullTransition)
: for the Weibull Transition Model
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survTrans(transition, 0.4, 2) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survTrans(transition, 0.4, 2) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) survTrans(transition, 0.4, 2)
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survTrans(transition, 0.4, 2) transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6) survTrans(transition, 0.4, 2) transition <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 2, p02 = 2.5, p12 = 3) survTrans(transition, 0.4, 2)
Event tracking in an oncology trial.
trackEventsPerTrial(data, timeP, byArm = FALSE)
trackEventsPerTrial(data, timeP, byArm = FALSE)
data |
( |
timeP |
( |
byArm |
( |
This function returns a data frame including number of PFS events, number of OS events,
number of recruited patients, number of censored patients and number of ongoing patients at timeP
.
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 0) ) simStudyWide <- getDatasetWideFormat(simStudy) trackEventsPerTrial(data = simStudyWide, timeP = 1.5, byArm = FALSE)
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1) transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1) simStudy <- getOneClinicalTrial( nPat = c(20, 20), transitionByArm = list(transition1, transition2), dropout = list(rate = 0.3, time = 10), accrual = list(param = "time", value = 0) ) simStudyWide <- getDatasetWideFormat(simStudy) trackEventsPerTrial(data = simStudyWide, timeP = 1.5, byArm = FALSE)
OS Survival Function from Weibull Transition Hazards
WeibSurvOS(t, h01, h02, h12, p01, p02, p12)
WeibSurvOS(t, h01, h02, h12, p01, p02, p12)
t |
( |
h01 |
(positive |
h02 |
(positive |
h12 |
(positive |
p01 |
(positive |
p02 |
(positive |
p12 |
(positive |
This returns the value of OS survival function at time t.
WeibSurvOS(c(1:5), 0.2, 0.5, 2.1, 1.2, 0.9, 1)
WeibSurvOS(c(1:5), 0.2, 0.5, 2.1, 1.2, 0.9, 1)
PFS Survival Function from Weibull Transition Hazards
WeibSurvPFS(t, h01, h02, p01, p02)
WeibSurvPFS(t, h01, h02, p01, p02)
t |
( |
h01 |
(positive |
h02 |
(positive |
p01 |
(positive |
p02 |
(positive |
This returns the value of PFS survival function at time t.
WeibSurvPFS(c(1:5), 0.2, 0.5, 1.2, 0.9)
WeibSurvPFS(c(1:5), 0.2, 0.5, 1.2, 0.9)
This creates a list with class TransitionParameters
containing
hazards, time intervals and Weibull rates for Weibull distributed event times
in an illness-death model.
weibull_transition(h01 = 1, h02 = 1, h12 = 1, p01 = 1, p02 = 1, p12 = 1)
weibull_transition(h01 = 1, h02 = 1, h12 = 1, p01 = 1, p02 = 1, p12 = 1)
h01 |
(positive |
h02 |
(positive |
h12 |
(positive |
p01 |
(positive |
p02 |
(positive |
p12 |
(positive |
List with elements hazards
, intervals
, weibull_rates
and family
(Weibull).
weibull_transition(h01 = 1, h02 = 1.3, h12 = 0.5, p01 = 1.2, p02 = 1.3, p12 = 0.5)
weibull_transition(h01 = 1, h02 = 1.3, h12 = 0.5, p01 = 1.2, p02 = 1.3, p12 = 0.5)