Skip to contents

Simulate Gompertzian death distribution

Usage

gompertztrunc_simu(
  n,
  formula,
  coefs,
  dummy = NULL,
  sigma = NULL,
  seed = NULL,
  a0 = 10^-4,
  b = 1/10,
  verbose = FALSE
)

Arguments

n

sample size

formula

estimation formula

coefs

named vectors of coefficients and corresponding true values

dummy

vector flags for each coefficient

sigma

standard deviation for each variable

seed

random seed to duplicate data

a0

Gompertz alpha parameter

b

Gompertz b parameter

verbose

print internal check if true

Value

dataframe of simulated death ages and covariate values

Examples

gompertztrunc_simu(n=1000, formula = death_age ~ sex + ambient_temp,
coefs = c('sex'=-0.8, 'ambient_temp'=0.3), dummy=c(TRUE,FALSE))
#>       death_age   sex ambient_temp
#>           <num> <num>        <num>
#>    1:  77.52337     0   -1.8959692
#>    2:  66.41964     1   -0.1427384
#>    3:  66.04230     0    1.4624257
#>    4:  71.25817     1    1.0746571
#>    5:  76.37782     1    0.6550567
#>   ---                             
#>  996:  86.15135     1   -0.9148510
#>  997:  81.08711     1   -0.4655203
#>  998:  50.74901     0    0.8196694
#>  999:  49.41549     1    1.5210357
#> 1000:  65.86126     1    0.2653548