Defines the model formula and distribution to be used when simulating time-to-events. Please see the user-guide for the model formulations
set_event(event, lambdaC, beta, shape, t_itv, change, keep)a .eventClass class containing time-to-events information
a matrix containing simulated time-to-events information
Distribution of time-to-events: event = "pwexp" for piece-wise exponential
distribution. event = "weibull" for Weibull distribution
Baseline hazard rate of internal control arm. Specify a vector for piece-wise
hazard with duration specified in t_itv if event = "pwexp"
covariates' coefficients (i.e. log hazard ratios). Must be equal in length to the number of covariates
created by simu_cov() (or less if restricted by keep) plus the number of covariates
defined by change.
the shape parameter of Weibull distribution if event = "weibull". NULL if
event = "pwexp"
a vector indicating interval lengths where the exponential rates provided in
lambdaC apply. Note that the length of t_itv is at least 1 less than that of
lambdaC and that the final value rate in lambdaC applies after time sum(t_itv).
NULL if event = "weibull"
A list of additional derivered covariates to be used in simulating time-to-events. See details
A character vector specifying which of the original covariates (i.e. those not
derived via the change argument) should be included into the model to simulate time-to-events.
If left unspecified all covariates will be included.
The change argument is used to specify additional derived covariates to be used when
simulating time-to-events. For example, let’s say have 3 covariates cov1, cov2 & cov3
but that we also wish to include a new covariate that is an interaction
between cov1 and cov2 as well as another covariate that is equal to the sum of
cov2 and cov3; we could implement this as follows:
set_event(
event = "weibull",
shape = 0.9,
lambdaC = 0.0135,
beta = c(5, 3, 1, 7, 9),
change = list(
c("cov1", "*", "cov2"),
c("cov2", "+", "cov3")
)
)
Note that in the above example 5 values have been specified to beta,
3 for the original three covariates
and 2 for the two additional derived covariates included via change.
Variables derived via change are automatically included in the model regardless
of whether they are listed in keep or not. Likewise, these covariates are derived
separately and not via a standard R formula, that is to say including an interaction
term does not automatically include the individual fixed effects.
# time-to-event follows a Weibull distribution
set_event(event = "weibull", shape = 0.9, lambdaC = 0.0135)
# time-to-event follows a piece-wise exponential distribution
set_event(event = "pwexp", t_itv = 1, lambdaC = c(0.1, 0.02))
Run the code above in your browser using DataLab