Skip to contents

Draw a time to event from a list of parametric survival functions

Usage

draw_tte(
  n_chosen,
  dist,
  coef1 = NULL,
  coef2 = NULL,
  coef3 = NULL,
  ...,
  beta_tx = 1,
  seed = NULL
)

Arguments

n_chosen

The number of observations to be drawn

dist

The distribution; takes values 'lnorm','norm','mvnorm','weibullPH','weibull','llogis','gompertz','gengamma','gamma','exp','beta','poisgamma'

coef1

First coefficient of the distribution, defined as in the coef() output on a flexsurvreg object (rate in "rpoisgamma")

coef2

Second coefficient of the distribution, defined as in the coef() output on a flexsurvreg object (theta in "rpoisgamma")

coef3

Third coefficient of the distribution, defined as in the coef() output on a flexsurvreg object (not used in "rpoisgamma")

...

Additional arguments to be used by the specific distribution (e.g., return_ind_rate if dist = "poisgamma")

beta_tx

Parameter in natural scale applied in addition to the scale/rate coefficient -e.g., a HR if used in an exponential- (not used in "rpoisgamma" nor "beta")

seed

An integer which will be used to set the seed for this draw.

Value

A vector of time to event estimates from the given parameters

Details

Other arguments relevant to each function can be called directly

Examples

draw_tte(n_chosen=1,dist='exp',coef1=1,beta_tx=1)
#> [1] 0.3651959
draw_tte(n_chosen=10,"poisgamma",coef1=1,coef2=1,obs_time=1,return_ind_rate=FALSE)
#> [[1]]
#> [1] 0.06041886 0.50724167 0.59027532
#> 
#> [[2]]
#> numeric(0)
#> 
#> [[3]]
#> [1] 0.5288419 0.5389195 0.8540457
#> 
#> [[4]]
#> numeric(0)
#> 
#> [[5]]
#> [1] 0.0855534 0.1801040 0.5533806 0.8627379 0.9968833
#> 
#> [[6]]
#> [1] 0.8283723 0.8977169
#> 
#> [[7]]
#> numeric(0)
#> 
#> [[8]]
#> [1] 0.2908869
#> 
#> [[9]]
#> [1] 0.5278916 0.5945091 0.6902560
#> 
#> [[10]]
#> [1] 0.1983629
#>