Skip to contents

Create a fake subject database

Usage

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
#>      <char> <char>     <POSc>     <POSc>
#>   1:   s001    f08 2019-01-31 2019-02-08
#>   2:   s001    f05 2019-02-28 2019-03-11
#>   3:   s002    f07 2019-02-01 2019-02-06
#>   4:   s002    f08 2019-03-08 2019-03-11
#>   5:   s003    f07 2019-02-08 2019-02-11
#>  ---                                    
#> 238:   s098    f07 2019-04-15 2019-04-20
#> 239:   s099    f03 2019-01-25 2019-02-04
#> 240:   s099    f05 2019-03-18 2019-03-25
#> 241:   s100    f08 2019-01-30 2019-01-31
#> 242:   s100    f08 2019-03-07 2019-03-13