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_event_per_visit = function(max_visit) rpois(max_visit, 0.5)
)

Arguments

.f_sample_max_visit

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

.f_sample_event_per_visit

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

Value

vector containing cumulative events

Details

""

Examples

replicate(5, sim_test_data_patient())
#> [[1]]
#>  [1]  0  2  2  4  5  6  6  7 10 10 10 11 12 13 13 13 14 15 15 15
#> 
#> [[2]]
#>  [1] 0 0 0 0 0 0 0 0 0 1 3 4 4 4 4 4 4 5
#> 
#> [[3]]
#>  [1]  0  2  3  4  5  6  7  7  7  7  9 11 11 11 12 12 12 13 14
#> 
#> [[4]]
#>  [1] 0 1 1 1 1 1 2 2 2 2 2 2 3 5 6 6
#> 
#> [[5]]
#>  [1]  1  1  1  3  3  5  6  6  7  7  7  7  7  7  7 10 12 12 12 12
#> 
replicate(5, sim_test_data_patient(
    .f_sample_event_per_visit = function(x) rpois(x, 1.2))
  )
#> [[1]]
#>  [1]  1  2  2  3  3  4  5  7  7  7 10 10 12 15 15 15 15 16 19 19 19 20 22 24
#> 
#> [[2]]
#>  [1]  2  4  5  6  6  6  6  6  8 10 12 13 14 15 17 19 20 23 24 25 26 26 28
#> 
#> [[3]]
#>  [1]  0  1  1  1  1  3  8  9  9 12 13 13 13 14 14 16 17 20 23 25 26 28 30 31 31
#> 
#> [[4]]
#>  [1]  2  2  2  3  4  7  9 10 10 11 12 13 16 16 17 17 17 18 18
#> 
#> [[5]]
#>  [1]  2  3  4  4  5  7 10 12 12 14 16 18 18 20 21 21 21 21 22 25
#> 
replicate(5, sim_test_data_patient(
    .f_sample_max_visit = function() rnorm(1, mean = 5, sd = 5))
  )
#> [[1]]
#> [1] 1 2 2
#> 
#> [[2]]
#> [1] 1
#> 
#> [[3]]
#> [1] 0 1
#> 
#> [[4]]
#> [1] 0 0 2 4 5 6 6 6
#> 
#> [[5]]
#> [1] 0 0 1 1 1 1 1
#>