Performance as true positive rate (tpr as tp/P) on the basis of desired false positive rates (fpr as fp/P).
Usage
get_portf_perf(df_scen, stat = "prob_low_prob_ur", fpr = c(0.001, 0.01, 0.05))
Arguments
- df_scen
dataframe as returned by
sim_ur_scenarios
- stat
character denoting the column name of the under-reporting statistic, Default: 'prob_low_prob_ur'
- fpr
numeric vector specifying false positive rates, Default: c(0.001, 0.01, 0.05)
See also
sim_test_data_study
get_config
sim_test_data_portfolio
sim_ur_scenarios
get_portf_perf
Examples
# \donttest{
df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 10,
frac_site_with_ur = 0.4, ur_rate = 0.6)
df_visit1$study_id <- "A"
df_visit2 <- sim_test_data_study(n_pat = 100, n_sites = 10,
frac_site_with_ur = 0.2, ur_rate = 0.1)
df_visit2$study_id <- "B"
df_visit <- dplyr::bind_rows(df_visit1, df_visit2)
df_site_max <- df_visit %>%
dplyr::group_by(study_id, site_number, patnum) %>%
dplyr::summarise(max_visit = max(visit),
max_ae = max(n_ae),
.groups = "drop")
df_config <- get_config(df_site_max)
df_config
#> # A tibble: 20 × 6
#> study_id ae_per_visit_mean site_number max_visit_sd max_visit_mean n_pat
#> <chr> <dbl> <chr> <dbl> <dbl> <int>
#> 1 0001 0.373 0001 3.79 19.2 10
#> 2 0001 0.373 0002 3.07 19.9 10
#> 3 0001 0.373 0003 1.91 17.9 10
#> 4 0001 0.373 0004 4.88 20 10
#> 5 0001 0.373 0005 3.43 19 10
#> 6 0001 0.373 0006 3.77 21.3 10
#> 7 0001 0.373 0007 3.45 18.9 10
#> 8 0001 0.373 0008 2.81 17.1 10
#> 9 0001 0.373 0009 5.27 17.4 10
#> 10 0001 0.373 0010 3.77 19.3 10
#> 11 0002 0.507 0001 3.57 18.5 10
#> 12 0002 0.507 0002 5.10 19.6 10
#> 13 0002 0.507 0003 4.44 19.8 10
#> 14 0002 0.507 0004 3.38 19.1 10
#> 15 0002 0.507 0005 2.72 21.4 10
#> 16 0002 0.507 0006 2.46 19.4 10
#> 17 0002 0.507 0007 5.29 19.3 10
#> 18 0002 0.507 0008 4.17 19.5 10
#> 19 0002 0.507 0009 3.68 18.2 10
#> 20 0002 0.507 0010 2.12 20.5 10
df_portf <- sim_test_data_portfolio(df_config)
df_portf
#> # A tibble: 3,896 × 8
#> study_id ae_per_visit_mean site_number max_visit_sd max_visit_mean patnum
#> <chr> <dbl> <chr> <dbl> <dbl> <chr>
#> 1 0001 0.373 0001 3.79 19.2 0001
#> 2 0001 0.373 0001 3.79 19.2 0001
#> 3 0001 0.373 0001 3.79 19.2 0001
#> 4 0001 0.373 0001 3.79 19.2 0001
#> 5 0001 0.373 0001 3.79 19.2 0001
#> 6 0001 0.373 0001 3.79 19.2 0001
#> 7 0001 0.373 0001 3.79 19.2 0001
#> 8 0001 0.373 0001 3.79 19.2 0001
#> 9 0001 0.373 0001 3.79 19.2 0001
#> 10 0001 0.373 0001 3.79 19.2 0001
#> # ℹ 3,886 more rows
#> # ℹ 2 more variables: visit <int>, n_ae <int>
df_scen <- sim_ur_scenarios(df_portf,
extra_ur_sites = 2,
ur_rate = c(0.5, 1))
#> aggregating site level
#> prepping for simulation
#> generating scenarios
#> getting under-reporting stats
#> evaluating stats
df_scen
#> # A tibble: 140 × 14
#> study_id site_number extra_ur_sites frac_pat_with_ur ur_rate n_pat
#> <chr> <chr> <dbl> <dbl> <dbl> <int>
#> 1 0001 0001 0 0 0 10
#> 2 0001 0001 0 0.111 0.5 10
#> 3 0001 0001 0 0.111 1 10
#> 4 0001 0001 1 0.211 0.5 10
#> 5 0001 0001 1 0.211 1 10
#> 6 0001 0001 2 0.311 0.5 10
#> 7 0001 0001 2 0.311 1 10
#> 8 0001 0002 0 0 0 10
#> 9 0001 0002 0 0.120 0.5 10
#> 10 0001 0002 0 0.120 1 10
#> # ℹ 130 more rows
#> # ℹ 8 more variables: n_pat_with_med75 <dbl>, visit_med75 <dbl>,
#> # mean_ae_site_med75 <dbl>, mean_ae_study_med75 <dbl>,
#> # n_pat_with_med75_study <int>, prob_low <dbl>, prob_low_adj <dbl>,
#> # prob_low_prob_ur <dbl>
df_perf <- get_portf_perf(df_scen)
df_perf
#> # A tibble: 27 × 5
#> fpr thresh extra_ur_sites ur_rate tpr
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0.001 0.872 0 0 0.05
#> 2 0.001 0.872 1 0 0.05
#> 3 0.001 0.872 2 0 0.05
#> 4 0.001 0.872 0 0.5 1
#> 5 0.001 0.872 1 0.5 0.95
#> 6 0.001 0.872 2 0.5 0.95
#> 7 0.001 0.872 0 1 1
#> 8 0.001 0.872 1 1 1
#> 9 0.001 0.872 2 1 1
#> 10 0.01 0.799 0 0 0.05
#> # ℹ 17 more rows
# }