Correct under-reporting probabilities using p.adjust.

eval_sites(df_sim_sites, method = "BH", under_only = TRUE, ...)

Arguments

df_sim_sites

dataframe generated by sim_sites

method

character, passed to stats::p.adjust(), if NULL eval_sites_deprecated() is used instead, Default = "BH"

under_only

compute under-reporting probabilities only, default = TRUE check_df_visit(), computationally expensive on large data sets. Default: TRUE

...

use to pass r_sim_sites parameter to eval_sites_deprecated()

Value

dataframe with the following columns:

study_id

study identification

site_number

site identification

visit_med75

median(max(visit)) * 0.75

mean_ae_site_med75

mean AE at visit_med75 site level

mean_ae_study_med75

mean AE at visit_med75 study level

pval

p-value as returned by poisson.test

prob_low

bootstrapped probability for having mean_ae_site_med75 or lower

pval_adj

adjusted p-values

prob_low_adj

adjusted bootstrapped probability for having mean_ae_site_med75 or lower

pval_prob_ur

probability under-reporting as 1 - pval_adj, poisson.test (use as benchmark)

prob_low_prob_ur

probability under-reporting as 1 - prob_low_adj, bootstrapped (use)

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_site <- site_aggr(df_visit)

df_sim_sites <- sim_sites(df_site, df_visit, r = 100)

df_eval <- eval_sites(df_sim_sites)
df_eval
#> # A tibble: 5 × 14
#>   study_id site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_med75
#>   <chr>    <chr>       <int>            <int>       <dbl>              <dbl>
#> 1 A        S0002          20               16          16               2.75
#> 2 A        S0001          20               16          15               2.62
#> 3 A        S0003          20               19          15               6.37
#> 4 A        S0004          20               16          16               7.81
#> 5 A        S0005          20               17          16               8.59
#> # ℹ 8 more variables: mean_ae_study_med75 <dbl>, n_pat_with_med75_study <int>,
#> #   pval <dbl>, prob_low <dbl>, pval_adj <dbl>, pval_prob_ur <dbl>,
#> #   prob_low_adj <dbl>, prob_low_prob_ur <dbl>

# use deprecated method  -------
df_eval <- eval_sites(df_sim_sites, method = NULL, r_sim_sites = 100)
#> Warning: using deprecated method for probability adjustment
df_eval
#> # A tibble: 5 × 19
#>   study_id site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_med75
#>   <chr>    <chr>       <int>            <int>       <dbl>              <dbl>
#> 1 A        S0002          20               16          16               2.75
#> 2 A        S0001          20               16          15               2.62
#> 3 A        S0003          20               19          15               6.37
#> 4 A        S0004          20               16          16               7.81
#> 5 A        S0005          20               17          16               8.59
#> # ℹ 13 more variables: mean_ae_study_med75 <dbl>, n_pat_with_med75_study <int>,
#> #   pval <dbl>, prob_low <dbl>, n_site <int>, pval_n_detected <int>,
#> #   pval_fp <dbl>, pval_p_vs_fp_ratio <dbl>, pval_prob_ur <dbl>,
#> #   prob_low_n_detected <int>, prob_low_fp <dbl>, prob_low_p_vs_fp_ratio <dbl>,
#> #   prob_low_prob_ur <dbl>