simulate AE under-reporting probabilities

simaerep(
  df_visit,
  param_site_aggr = list(method = "med75_adj", min_pat_pool = 0.2),
  param_sim_sites = list(r = 1000, poisson_test = FALSE, prob_lower = TRUE),
  param_eval_sites = list(method = "BH"),
  progress = TRUE,
  check = TRUE,
  env = parent.frame(),
  under_only = TRUE
)

Arguments

df_visit

data frame with columns: study_id, site_number, patnum, visit, n_ae

param_site_aggr

list of parameters passed to site_aggr(), Default: list(method = "med75_adj", min_pat_pool = 0.2)

param_sim_sites

list of parameters passed to sim_sites(), Default: list(r = 1000, poisson_test = FALSE, prob_lower = TRUE)

param_eval_sites

list of parameters passed to eval_sites(), Default: list(method = "BH")

progress

logical, display progress bar, Default = TRUE

check

logical, perform data check and attempt repair with check_df_visit(), computationally expensive on large data sets. Default: TRUE

env

optional, provide environment of original visit data, Default: parent.frame()

under_only,

logical compute under-reporting probabilities only, superseeds under_only parameter passed to eval_sites() and sim_sites(), Default: TRUE

Value

simaerep object

Details

executes site_aggr(), sim_sites() and eval_sites() on original visit data and stores all intermediate results. Stores lazy reference to original visit data for facilitated plotting using generic plot(x).

Examples


df_visit <- sim_test_data_study(
  n_pat = 100,
  n_sites = 5,
  frac_site_with_ur = 0.4,
  ur_rate = 0.6
)

df_visit$study_id <- "A"

aerep <- simaerep(df_visit)

aerep
#> simaerep object:
#> Check aerep$df_eval prob_low_prob_ur column for AE under-reporting probabilites.
#> Plot results using plot() generic.

str(aerep)
#> List of 7
#>  $ visit           :List of 3
#>   ..$ dim       : int [1:2] 1969 9
#>   ..$ df_summary: tibble [1 × 5] (S3: tbl_df/tbl/data.frame)
#>   .. ..$ n_studies : int 1
#>   .. ..$ n_sites   : int 5
#>   .. ..$ n_patients: int 100
#>   .. ..$ n_visits  : int 1969
#>   .. ..$ n_aes     : int 703
#>   ..$ str_call  : chr "df_visit"
#>   ..- attr(*, "class")= chr "orivisit"
#>  $ df_site         : tibble [5 × 6] (S3: tbl_df/tbl/data.frame)
#>   ..$ study_id          : chr [1:5] "A" "A" "A" "A" ...
#>   ..$ site_number       : chr [1:5] "S0001" "S0002" "S0003" "S0004" ...
#>   ..$ n_pat             : int [1:5] 20 20 20 20 20
#>   ..$ n_pat_with_med75  : int [1:5] 17 18 17 20 16
#>   ..$ visit_med75       : Named num [1:5] 17 15 16 15 16
#>   .. ..- attr(*, "names")= chr [1:5] "80%" "80%" "80%" "80%" ...
#>   ..$ mean_ae_site_med75: num [1:5] 3.06 2.56 8.53 6.4 8.38
#>  $ df_sim_sites    : tibble [5 × 9] (S3: tbl_df/tbl/data.frame)
#>   ..$ study_id              : chr [1:5] "A" "A" "A" "A" ...
#>   ..$ site_number           : chr [1:5] "S0001" "S0002" "S0003" "S0004" ...
#>   ..$ n_pat                 : int [1:5] 20 20 20 20 20
#>   ..$ n_pat_with_med75      : int [1:5] 17 18 17 20 16
#>   ..$ visit_med75           : Named num [1:5] 17 15 16 15 16
#>   .. ..- attr(*, "names")= chr [1:5] "80%" "80%" "80%" "80%" ...
#>   ..$ mean_ae_site_med75    : num [1:5] 3.06 2.56 8.53 6.4 8.38
#>   ..$ mean_ae_study_med75   : num [1:5] 7.03 6.18 5.23 5.19 5.31
#>   ..$ n_pat_with_med75_study: int [1:5] 59 72 66 70 67
#>   ..$ prob_low              : num [1:5] 0 0 1 1 1
#>  $ df_eval         : tibble [5 × 11] (S3: tbl_df/tbl/data.frame)
#>   ..$ study_id              : chr [1:5] "A" "A" "A" "A" ...
#>   ..$ site_number           : chr [1:5] "S0001" "S0002" "S0003" "S0004" ...
#>   ..$ n_pat                 : int [1:5] 20 20 20 20 20
#>   ..$ n_pat_with_med75      : int [1:5] 17 18 17 20 16
#>   ..$ visit_med75           : Named num [1:5] 17 15 16 15 16
#>   .. ..- attr(*, "names")= chr [1:5] "80%" "80%" "80%" "80%" ...
#>   ..$ mean_ae_site_med75    : num [1:5] 3.06 2.56 8.53 6.4 8.38
#>   ..$ mean_ae_study_med75   : num [1:5] 7.03 6.18 5.23 5.19 5.31
#>   ..$ n_pat_with_med75_study: int [1:5] 59 72 66 70 67
#>   ..$ prob_low              : num [1:5] 0 0 1 1 1
#>   ..$ prob_low_adj          : num [1:5] 0 0 1 1 1
#>   ..$ prob_low_prob_ur      : num [1:5] 1 1 0 0 0
#>  $ param_site_aggr :List of 2
#>   ..$ method      : chr "med75_adj"
#>   ..$ min_pat_pool: num 0.2
#>  $ param_sim_sites :List of 4
#>   ..$ r           : num 1000
#>   ..$ poisson_test: logi FALSE
#>   ..$ prob_lower  : logi TRUE
#>   ..$ under_only  : logi TRUE
#>  $ param_eval_sites:List of 2
#>   ..$ method    : chr "BH"
#>   ..$ under_only: logi TRUE
#>  - attr(*, "class")= chr "simaerep"