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. Used by simaerep_classic()
Usage
sim_sites(
df_site,
df_visit,
r = 1000,
poisson_test = TRUE,
prob_lower = TRUE,
progress = 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
- 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
simaerep_classic
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_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| 17| 17| 17.24| 12.97| 61| 1.00| 1.00|
#> |A |S0002 | 20| 19| 16| 17.68| 12.60| 68| 1.00| 1.00|
#> |A |S0003 | 20| 20| 15| 11.30| 14.37| 71| 0.00| 0.00|
#> |A |S0004 | 20| 17| 15| 10.88| 14.34| 74| 0.00| 0.00|
#> |A |S0005 | 20| 18| 15| 11.78| 14.16| 73| 0.01| 0.03|