set_event {psborrow} | R Documentation |
Set up time-to-events
Description
Defines the model formula and distribution to be used when simulating time-to-events. Please see the user-guide for the model formulations
Usage
set_event(event, lambdaC, beta, shape, t_itv, change, keep)
Arguments
event |
Distribution of time-to-events: |
lambdaC |
Baseline hazard rate of internal control arm. Specify a vector for piece-wise
hazard with duration specified in |
beta |
covariates' coefficients (i.e. log hazard ratios). Must be equal in length to the number of covariates
created by |
shape |
the shape parameter of Weibull distribution if |
t_itv |
a vector indicating interval lengths where the exponential rates provided in
|
change |
A list of additional derivered covariates to be used in simulating time-to-events. See details |
keep |
A character vector specifying which of the original covariates (i.e. those not
derived via the |
Details
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.
Value
a .eventClass
class containing time-to-events information
a matrix
containing simulated time-to-events information
Examples
# 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))