Skip to contents

Calculate prob_lower for study sites using table operations

Usage

sim_inframe(df_visit, r = 1000, df_site = NULL)

Arguments

df_visit

Data frame with columns: study_id, site_number, patnum, visit, n_ae.

r

Integer or tbl_object, number of repetitions for bootstrap simulation. Pass a tbl object referring to a table with one column and as many rows as desired repetitions. Default: 1000.

df_site,

dataframe as returned be site_aggr(), Will switch to visit_med75. Default: NULL

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"

df_sim <- sim_inframe(df_visit)
df_eval <- eval_sites(df_sim)
df_eval
#> # A tibble: 5 × 10
#>   study_id site_number events_per_visit_site events visits n_pat prob_low
#>   <chr>    <chr>                       <dbl>  <dbl>  <dbl> <int>    <dbl>
#> 1 A        S0001                       0.188     75    400    20    0    
#> 2 A        S0002                       0.186     75    403    20    0    
#> 3 A        S0003                       0.496    187    377    20    0.998
#> 4 A        S0004                       0.453    180    397    20    0.98 
#> 5 A        S0005                       0.492    187    380    20    0.998
#> # ℹ 3 more variables: events_per_visit_study <dbl>, prob_low_adj <dbl>,
#> #   prob_low_prob_ur <dbl>