simu_time: Simulate time-to-events for multiple scenarios

View source: R/simu_time.R

simu_timeR Documentation

Simulate time-to-events for multiple scenarios

Description

Simulate time-to-events for multiple scenarios

Usage

simu_time(dt, eventObj, clinInt, clinExt, seed, path)

Arguments

dt

a list of matrix generated in simu_cov containing simulated covariates information

eventObj

an object of class .eventClass generated in set_event including event information

clinInt

an object of class .clinClass generated in set_clin including internal trial information

clinExt

an object of class .clinClass generated in set_clin including external trial information

seed

the seed of R‘s random number generator. Default is the first element of .Random.seed

path

file name for saving the output including folder path

Value

a list of matrix containing simulated time-to-events information

Examples

# simulate patient-level data without covariates
# simulate survival time following weibull distribution

# simulate trial indicator and set hazard ratios
sample = set_n(ssC = 10, ssE = 20, ssExt = 40)
sample_hr <- simu_cov(ssObj = sample, HR = 1, driftHR=c(1,1.2), nsim = 10)

# enrollment pattern, drop-out, analysis start time
c_int = set_clin(gamma = 2, e_itv = 10, etaC = 0.5,  CCOD = "fixed-first", CCOD_t = 64)
c_ext = c_int

# simulate time-to-event with a weibull distribution
evt1 <- set_event(event = "weibull", shape = 0.8, lambdaC = 0.01)
simu_time(dt = sample_hr, eventObj = evt1, clinInt = c_int, clinExt = c_ext)

# simulate time-to-event with an exponential distribution
evt2 <- set_event(event = "pwexp", t_itv = 1, lambdaC = c(0.1, 0.02))
simu_time(dt = sample_hr, eventObj = evt2, clinInt = c_int, clinExt = c_int)



psborrow documentation built on March 7, 2023, 8:32 p.m.