Skip to contents

Test function, test applicability of poisson test, by calculating

  • the bootstrapped probability of obtaining a specific p-value or lower, use in combination with sim_studies().

Usage

get_ecd_values(df_sim_studies, df_sim_sites, val_str)

Arguments

df_sim_studies

dataframe, generated by sim_studies()

df_sim_sites

dataframe, generated by sim_sites()

val_str

c("prob_low","pval")

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/prob_low

p-value as returned by poisson.test

pval/prob_low_ecd

p-value as returned by poisson.test

Details

trains a ecdf function for each studies based on the results of sim_studies()

Examples

df_visit <- sim_test_data_study(n_pat = 100, n_sites = 5,
    frac_site_with_ur = 0.4, ur_rate = 0.3)

df_visit$study_id <- "A"
df_site <- site_aggr(df_visit)

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

df_sim_studies <- sim_studies(
  df_site = df_site,
  df_visit = df_visit,
  r = 3,
  parallel = FALSE,
  poisson_test = TRUE,
  prob_lower = TRUE
)

get_ecd_values(df_sim_studies, df_sim_sites, "prob_low")
#> # A tibble: 5 × 11
#>   study_id site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_med75
#>   <chr>    <chr>       <int>            <dbl>       <dbl>              <dbl>
#> 1 A        S0001          20               18          15               5.28
#> 2 A        S0002          20               17          16               6.12
#> 3 A        S0003          20               17          16               8.35
#> 4 A        S0004          20               20          15               6.55
#> 5 A        S0005          20               16          15               7.62
#> # ℹ 5 more variables: mean_ae_study_med75 <dbl>, n_pat_with_med75_study <int>,
#> #   pval <dbl>, prob_low <dbl>, prob_low_ecd <dbl>
get_ecd_values(df_sim_studies, df_sim_sites, "pval")
#> # A tibble: 5 × 11
#>   study_id site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_med75
#>   <chr>    <chr>       <int>            <dbl>       <dbl>              <dbl>
#> 1 A        S0001          20               18          15               5.28
#> 2 A        S0002          20               17          16               6.12
#> 3 A        S0003          20               17          16               8.35
#> 4 A        S0004          20               20          15               6.55
#> 5 A        S0005          20               16          15               7.62
#> # ℹ 5 more variables: mean_ae_study_med75 <dbl>, n_pat_with_med75_study <int>,
#> #   pval <dbl>, prob_low <dbl>, pval_ecd <dbl>