Skip to contents

helper function for sim_test_data_study()

Usage

sim_test_data_patient(
  .f_sample_max_visit = function() rnorm(1, mean = 20, sd = 4),
  .f_sample_ae_per_visit = function(max_visit) rpois(max_visit, 0.5)
)

Arguments

.f_sample_max_visit

function used to sample the maximum number of aes, Default: function() rnorm(1, mean = 20, sd = 4)

.f_sample_ae_per_visit

function used to sample the aes for each visit, Default: function(x) rpois(x, 0.5)

Value

vector containing cumulative aes

Details

""

Examples

replicate(5, sim_test_data_patient())
#> [[1]]
#>  [1]  1  2  3  3  4  4  4  4  4  4  5  5  5  7  8  9 10 10 11 11 12 14 14
#> 
#> [[2]]
#>  [1]  2  2  3  4  5  5  5  6  6  6  7  7  8  9  9 11 11 11 11 11 11 11 12 12
#> 
#> [[3]]
#>  [1]  2  4  5  7  7  8  9 11 11 11 12 12 13 14 14 15 15 15 15 15 15
#> 
#> [[4]]
#>  [1] 0 0 1 2 3 3 3 3 4 5 5 5 5 5
#> 
#> [[5]]
#>  [1]  1  1  1  1  1  1  2  2  4  4  4  4  6  6  7  7  7  8  9 11 12 12
#> 
replicate(5, sim_test_data_patient(
    .f_sample_ae_per_visit = function(x) rpois(x, 1.2))
  )
#> [[1]]
#>  [1]  1  3  3  5  6  6  6  6  8  8  9 13 15 15 16 16
#> 
#> [[2]]
#>  [1]  2  3  4  4  4  8  9  9 11 11 11 13 15 16 16 18 22 23 23 24 25
#> 
#> [[3]]
#>  [1]  2  2  3  3  3  3  5  8  9 11 13 14 16 16 17 19 21 23 23 23 24
#> 
#> [[4]]
#>  [1]  2  4  5  5  9  9 10 11 12 16 16 20 21 22 24 25 27 29 31 34 36 37 41 41 45
#> [26] 47
#> 
#> [[5]]
#>  [1]  0  1  1  2  3  3  3  4  4  5  5  5  5  7  9 11 13 15 16 16 16 17
#> 
replicate(5, sim_test_data_patient(
    .f_sample_max_visit = function() rnorm(1, mean = 5, sd = 5))
  )
#> [[1]]
#> [1] 0 2 2 4 4 4
#> 
#> [[2]]
#> [1] 1
#> 
#> [[3]]
#> [1] 0 0 0
#> 
#> [[4]]
#>  [1] 3 3 3 3 4 4 4 4 4 4
#> 
#> [[5]]
#>  [1] 1 1 2 3 3 3 3 3 3 3 3 4 4 4 4 4 6
#>