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.
Usage
sim_sites(
df_site,
df_visit,
r = 1000,
poisson_test = TRUE,
prob_lower = TRUE,
progress = TRUE,
check = TRUE,
under_only = 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
- under_only
compute under-reporting probabilities only, default = TRUE 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
sim_sites
,
site_aggr
,
pat_pool
,
prob_lower_site_ae_vs_study_ae
,
poiss_test_site_ae_vs_study_ae
,
sim_sites
,
prep_for_sim
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| 20| 15| 6.35| 6.31| 71| 1.00| 1.00|
#> |A |S0002 | 20| 19| 15| 5.37| 6.57| 72| 0.06| 0.06|
#> |A |S0003 | 20| 18| 15| 7.11| 6.12| 73| 1.00| 1.00|
#> |A |S0004 | 20| 15| 17| 7.87| 7.03| 61| 1.00| 1.00|
#> |A |S0005 | 20| 19| 15| 6.37| 6.31| 72| 1.00| 1.00|