Create a fake subject database

create_fake_subjectDB(
  n_subjects = 100,
  n_facilities = 10,
  avg_n_stays = 3,
  days_since_discharge = NULL,
  length_of_stay = NULL,
  start_id_subjects = 1,
  start_id_facilities = 1,
  with_errors = FALSE
)

Arguments

n_subjects

the number of different subjects in the database

n_facilities

the number of facility present in the database

avg_n_stays

the average number of stays per subject

days_since_discharge

the number of days between a discharge date and an admission date (default: max(0, rnorm(1, mean = 30, sd = 10)))

length_of_stay

the length of stay (default: max(1, rnorm(1, mean = 5, sd = 3) )

start_id_subjects, start_id_facilities

change starting ids (used for clustered network)

with_errors

(boolean) introduce or not random errors in the database. Default to FALSE.

Value

a data.table containing all subjects stays

Examples

mydb <- create_fake_subjectDB(n_subjects = 100, n_facilities = 10)
mydb
#>       sID fID      Adate      Ddate
#>   1: s001 f06 2019-02-10 2019-02-14
#>   2: s002 f05 2019-02-15 2019-02-17
#>   3: s002 f10 2019-03-13 2019-03-22
#>   4: s002 f07 2019-04-15 2019-04-19
#>   5: s002 f03 2019-06-03 2019-06-06
#>  ---                               
#> 247: s099 f07 2019-04-02 2019-04-06
#> 248: s099 f09 2019-05-15 2019-05-21
#> 249: s100 f10 2019-01-14 2019-01-19
#> 250: s100 f04 2019-02-13 2019-02-14
#> 251: s100 f05 2019-03-07 2019-03-08