Internal function called by sim_sites
after prep_for_sim
Usage
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
Examples
df_visit <- sim_test_data_study(
n_pat = 100,
n_sites = 5,
ratio_out = 0.4,
factor_event_rate = 0.6
) %>%
# internal functions require internal column names
dplyr::rename(
n_ae = n_event,
site_number = site_id,
patnum = patient_id
)
df_site <- site_aggr(df_visit)
df_prep <- simaerep:::prep_for_sim(df_site, df_visit)
df_sim <- simaerep:::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> <dbl> <int> <dbl>
#> 1 A S0001 20 20 15 18.8
#> 2 A S0002 20 17 16 18
#> 3 A S0003 20 17 16 12
#> 4 A S0004 20 20 15 10.2
#> 5 A S0005 20 16 15 11.2
#> # ℹ 3 more variables: mean_ae_study_med75 <dbl>, n_pat_with_med75_study <int>,
#> # prob_low <dbl>