Collects the number of AEs of all eligible patients that meet visit_med75 criteria of site. Then calculates poisson.test pvalue and bootstrapped probability of having a lower mean value.

sim_sites(
  df_site,
  df_visit,
  r = 1000,
  poisson_test = TRUE,
  prob_lower = TRUE,
  progress = TRUE,
  check = TRUE
)

Arguments

df_site

dataframe created by site_aggr

df_visit

dataframe, created by sim_sites

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

check,

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

Value

dataframe with the following columns:

study_id

study identification

site_number

site identification

n_pat

number of patients at site

visit_med75

median(max(visit)) * 0.75

n_pat_with_med75

number of patients at site with med75

mean_ae_site_med75

mean AE at visit_med75 site level

mean_ae_study_med75

mean AE at visit_med75 study level

n_pat_with_med75_study

number of patients at study with med75 excl. site

pval

p-value as returned by poisson.test

prob_low

bootstrapped probability for having mean_ae_site_med75 or lower

See also

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_sim_sites <- sim_sites(df_site, df_visit, r = 100) df_sim_sites %>% knitr::kable(digits = 2)
#> #> #> |study_id |site_number | n_pat| n_pat_with_med75| visit_med75| mean_ae_site_med75| mean_ae_study_med75| n_pat_with_med75_study| pval| prob_low| #> |:--------|:-----------|-----:|----------------:|-----------:|------------------:|-------------------:|----------------------:|----:|--------:| #> |A |S0001 | 20| 19| 15| 6.63| 7.07| 71| 0.56| 0.26| #> |A |S0002 | 20| 18| 15| 6.11| 7.19| 72| 0.12| 0.10| #> |A |S0003 | 20| 17| 16| 8.53| 7.17| 66| 1.00| 1.00| #> |A |S0004 | 20| 20| 15| 6.40| 7.14| 70| 0.29| 0.14| #> |A |S0005 | 20| 16| 16| 8.38| 7.22| 67| 1.00| 1.00|