Internal function called by sim_sites after prep_for_sim

sim_after_prep(
  df_sim_prep,
  r = 1000,
  poisson_test = FALSE,
  prob_lower = TRUE,
  progress = FALSE,
  under_only = TRUE
)

Arguments

df_sim_prep

dataframe as returned by prep_for_sim

r

integer, denotes number of simulations, default = 1000

poisson_test

logical, calculates poisson.test pvalue

prob_lower

logical, calculates probability for getting a lower value

progress

logical, display progress bar, Default = TRUE

under_only

compute under-reporting probabilities only, default = TRUE check_df_visit(), computationally expensive on large data sets. Default: TRUE

Value

dataframe

Examples

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

df_visit$study_id <- "A"

df_site <- site_aggr(df_visit)

df_prep <- prep_for_sim(df_site, df_visit)

df_sim <- sim_after_prep(df_prep)

df_sim
#> # A tibble: 5 × 9
#>   study_id site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_med75
#>   <chr>    <chr>       <int>            <int>       <dbl>              <dbl>
#> 1 A        S0001          20               20          15               6.1 
#> 2 A        S0002          20               17          16               6.53
#> 3 A        S0003          20               17          16               8.35
#> 4 A        S0004          20               20          15               6.55
#> 5 A        S0005          20               16          15               7.62
#> # ℹ 3 more variables: mean_ae_study_med75 <dbl>, n_pat_with_med75_study <int>,
#> #   prob_low <dbl>