diff --git a/.Rbuildignore b/.Rbuildignore index 676ea8f..3648426 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,3 +14,4 @@ ^\.git ^cran-comments\.md$ ^data-raw$ +^CRAN-SUBMISSION$ diff --git a/DESCRIPTION b/DESCRIPTION index c9c32c7..2d945b0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,16 +1,20 @@ Package: simaerep -Title: Simulate Adverse Event Reporting in Clinical Trials with the Goal of Detecting under-Reporting Sites +Title: Find Clinical Trial Sites Under-Reporting Adverse Events Version: 0.4.2 -Authors@R: +Authors@R: c( person(given = "Bjoern", family = "Koneswarakantha", - role = c("aut", "cre"), + role = c("aut", "cre", "cph"), email = "bjoern.koneswarakantha@roche.com", - comment = c(ORCID = "0000-0003-4585-7799")) -Description: This can detect clinical trial sites that are under-reporting adverse events (AE). - Bootstrap-based simulations are used to simulate AE reporting and to assign an AE - under-reporting probability to each site in a clinical trial (Koneswarakantha 2021 - ). + comment = c(ORCID = "0000-0003-4585-7799")), + person("F. Hoffmann-La Roche Ltd", + role = c("cph")) + ) +Description: Monitoring of Adverse Event (AE) reporting in clinical trials is + important for patient safety. Sites that are under-reporting AEs can be detected + using Bootstrap-based simulations that simulate overall AE reporting. Based on the + simulation an AE under-reporting probability is assigned to each site in a + given trial (Koneswarakantha 2021 ). URL: https://openpharma.github.io/simaerep/, https://github.com/openpharma/simaerep License: MIT + file LICENSE Encoding: UTF-8 diff --git a/R/S3_simaerep.R b/R/S3_simaerep.R index 804195c..4093c3f 100644 --- a/R/S3_simaerep.R +++ b/R/S3_simaerep.R @@ -176,7 +176,7 @@ simaerep <- function(df_visit, #' @details see [plot_study()][plot_study] and #' [plot_visit_med75()][plot_visit_med75] #' @examples -#' \dontrun{ +#' \donttest{ #' df_visit <- sim_test_data_study( #' n_pat = 100, #' n_sites = 5, diff --git a/R/lint.R b/R/lint.R index 34e1416..d46482d 100644 --- a/R/lint.R +++ b/R/lint.R @@ -6,9 +6,10 @@ #' cyclocomp_linter = lintr::cyclocomp_linter(25) #' @param path character #' @inheritParams lintr::lint_package -#' @return " " +#' @return No return value, called for side effects #' @seealso \code{\link[lintr]{lint_package}} #' @rdname lint_package +#' @noRd lint_package <- function(path = ".", ...) { lint_results <- lintr::lint_package(path = path, @@ -21,9 +22,9 @@ lint_package <- function(path = ".", ...) { ...) if (length(lint_results) > 0) { - print(lint_results) # does not work wit cat() + message(lint_results) # does not work wit cat() stop(paste(lint_results)) } else { - print("no lint violations") + message("no lint violations") } } diff --git a/R/progress.R b/R/progress.R index c61532b..51f396d 100644 --- a/R/progress.R +++ b/R/progress.R @@ -1,7 +1,7 @@ #' @title Execute a purrr or furrr function with a progress #' bar. #' @description Internal utility function. -#' @details Call still needs to be wrapped in \code{\link[progressr]{with_progress}} +#' @details Call still needs to be wrapped in \code{\link[progressr]{with_progress}} #' or [with_progress_cnd()][with_progress_cnd()] #' @param .purrr purrr or furrr function #' @param ... iterable arguments passed to .purrr @@ -17,7 +17,7 @@ #' purrr_bar(rep(0.25, 5), .purrr = purrr::map, .f = Sys.sleep, .steps = 5) #' ) #' -#'\dontrun{ +#'\donttest{ #' # purrr::walk #' progressr::with_progress( #' purrr_bar(rep(0.25, 5), .purrr = purrr::walk,.f = Sys.sleep, .steps = 5) @@ -67,10 +67,11 @@ #' #' # with mutate #' progressr::with_progress( -#' tibble(x = rep(0.25, 5)) %>% -#' mutate(x = purrr_bar(x, .purrr = purrr::map, .f = Sys.sleep, .steps = 5)) +#' tibble::tibble(x = rep(0.25, 5)) %>% +#' dplyr::mutate(x = purrr_bar(x, .purrr = purrr::map, .f = Sys.sleep, .steps = 5)) #' ) #'} +#' @return result of function passed to .f #' @rdname purrr_bar #' @export purrr_bar <- function(..., @@ -116,7 +117,8 @@ purrr_bar <- function(..., #'@param ex expression #'@param progress logical, Default: TRUE #'@details This wrapper adds a progress parameter to \code{\link[progressr]{with_progress}} -#' so that we can control the progress bar in the user facing functions. +#' so that we can control the progress bar in the user facing functions. The progressbar +#' only shows in interactive mode. #' @examples #' if (interactive()) { #' @@ -155,6 +157,7 @@ purrr_bar <- function(..., #' ) #' ) #'} +#'@return No return value, called for side effects #'@seealso \code{\link[progressr]{with_progress}} #'@rdname with_progress_cnd #'@export diff --git a/R/simaerep.R b/R/simaerep.R index bf835fc..7159176 100644 --- a/R/simaerep.R +++ b/R/simaerep.R @@ -1030,7 +1030,7 @@ get_pat_pool_config <- function(df_visit, df_site, min_n_pat_with_med75 = 1) { #' are calculated. #' @return dataframe #' @examples -#' \dontrun{ +#' \donttest{ #' df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 5, #' frac_site_with_ur = 0.4, ur_rate = 0.6) #' @@ -1046,7 +1046,8 @@ get_pat_pool_config <- function(df_visit, df_site, min_n_pat_with_med75 = 1) { #' df_site <- site_aggr(df_visit) #' #' sim_studies(df_visit, df_site, r = 3, keep_ae = TRUE) -#' +#'} +#' \dontrun{ #' # parallel processing ------------------------- #' library(future) #' future::plan(multiprocess) diff --git a/R/simaerep_plot.R b/R/simaerep_plot.R index d298489..8f796ca 100644 --- a/R/simaerep_plot.R +++ b/R/simaerep_plot.R @@ -138,11 +138,12 @@ plot_dots <- function(df, #' @param color_low character, hex color value, Default: '#25A69A' #' @param title logical, include title, Default: T #' @param legend logical, include legend, Default: T +#' @param seed pass seed for simulations Default: 5 #' @return ggplot #' @details uses [plot_dots()][plot_dots()] and adds 2 simulation panels, uses made-up #' site config with three sites A,B,C simulating site C #' @examples -#' \dontrun{ +#' \donttest{ #' plot_sim_example(size_dots = 5) #' } #' @seealso @@ -158,8 +159,9 @@ plot_sim_example <- function(substract_ae_per_pat = 0, color_high = "#00695C", color_low = "#25A69A", title = TRUE, - legend = TRUE) { - set.seed(5) + legend = TRUE, + seed = 5) { + set.seed(seed) study <- tibble( site = LETTERS[1:3], @@ -292,13 +294,14 @@ plot_sim_example <- function(substract_ae_per_pat = 0, #' @param ... parameters passed to plot_sim_example() #' @details This function is a wrapper for plot_sim_example() #' @examples -#' \dontrun{ +#' \donttest{ #' plot_sim_examples(size_dot = 3, size_raster_label = 10) #' plot_sim_examples() #' } #' @seealso #' \code{\link[cowplot]{ggdraw}},\code{\link[cowplot]{draw_label}},\code{\link[cowplot]{plot_grid}} #' @rdname plot_sim_examples +#' @return ggplot #' @export plot_sim_examples <- function(substract_ae_per_pat = c(0, 1, 3), ...) { @@ -403,7 +406,7 @@ plot_sim_examples <- function(substract_ae_per_pat = c(0, 1, 3), ...) { #' number of patients. Patients that have not been on the study long enough to #' reach the evaluation point (visit_med75) will be ignored. #' @examples -#' \dontrun{ +#' \donttest{ #' df_visit <- sim_test_data_study(n_pat = 1000, n_sites = 10, #' frac_site_with_ur = 0.2, ur_rate = 0.15, max_visit_sd = 8) #' @@ -682,7 +685,7 @@ plot_study <- function(df_visit, labs(y = "Mean Cumulative AE Count per Site") if (length(sites_ordered) == 0) { - print("no sites with P/FP ratio > 1") + message("no sites with P/FP ratio > 1") return(p_study) } diff --git a/R/simulate_test_data.R b/R/simulate_test_data.R index c422670..b4f39ef 100644 --- a/R/simulate_test_data.R +++ b/R/simulate_test_data.R @@ -186,7 +186,7 @@ sim_scenario <- function(n_ae_site, n_ae_study, frac_pat_with_ur, ur_rate) { #' run. For this to work we need to specify the plan for how the code should #' run, e.g. plan(multisession, workers = 18) #' @examples -#' if (interactive()) { +#' \donttest{ #' df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 10, #' frac_site_with_ur = 0.4, ur_rate = 0.6) #' @@ -200,8 +200,8 @@ sim_scenario <- function(n_ae_site, n_ae_study, frac_pat_with_ur, ur_rate) { #' df_visit <- dplyr::bind_rows(df_visit1, df_visit2) #' #' df_site_max <- df_visit %>% -#' group_by(study_id, site_number, patnum) %>% -#' summarise(max_visit = max(visit), +#' dplyr::group_by(study_id, site_number, patnum) %>% +#' dplyr::summarise(max_visit = max(visit), #' max_ae = max(n_ae), #' .groups = "drop") #' @@ -406,7 +406,7 @@ sim_ur_scenarios <- function(df_portf, #' run. For this to work we need to specify the plan for how the code should #' run, e.g. `plan(multisession, workers = 3) #' @examples -#' if (interactive()) { +#' \donttest{ #' df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 10, #' frac_site_with_ur = 0.4, ur_rate = 0.6) #' @@ -420,8 +420,8 @@ sim_ur_scenarios <- function(df_portf, #' df_visit <- dplyr::bind_rows(df_visit1, df_visit2) #' #' df_site_max <- df_visit %>% -#' group_by(study_id, site_number, patnum) %>% -#' summarise(max_visit = max(visit), +#' dplyr::group_by(study_id, site_number, patnum) %>% +#' dplyr::summarise(max_visit = max(visit), #' max_ae = max(n_ae), #' .groups = "drop") #' @@ -559,22 +559,22 @@ sim_test_data_portfolio <- function(df_config, parallel = FALSE, progress = TRUE #' site} \item{**max_visit_mean**}{mean of maximum patient visits per site} #' \item{**n_pat**}{number of patients} } #' @examples -#' if (interactive()) { +#' \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 %>% -#' group_by(study_id, site_number, patnum) %>% -#' summarise(max_visit = max(visit), +#' dplyr::group_by(study_id, site_number, patnum) %>% +#' dplyr::summarise(max_visit = max(visit), #' max_ae = max(n_ae), #' .groups = "drop") #' @@ -674,7 +674,7 @@ get_config <- function(df_site, #' @return dataframe #' @details DETAILS #' @examples -#' \dontrun{ +#' \donttest{ #' df_visit1 <- sim_test_data_study(n_pat = 100, n_sites = 10, #' frac_site_with_ur = 0.4, ur_rate = 0.6) #' diff --git a/R/utils-pipe.R b/R/utils-pipe.R index e79f3d8..9e728fe 100644 --- a/R/utils-pipe.R +++ b/R/utils-pipe.R @@ -8,4 +8,5 @@ #' @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs +#' @return returns output of rhs function NULL diff --git a/_pkgdown.yml b/_pkgdown.yml index 4e1134a..082351f 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -95,6 +95,3 @@ reference: - plot_sim_examples - plot_sim_example - plot_dots -- title: internal - contents: - - lint_package diff --git a/cran-comments.md b/cran-comments.md index 456ce99..9d28b7b 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,60 @@ +# Resubmission of simaerep + +Thank you for taking the time to review my submission. I have addressed all of your +comments. + +## DESCRIPTION + +Please reduce the length of the title to less than 65 characters. + +*done* + +Please do not start the description with "This package", package name, +title or similar. +I would start with: "Detect clinical trial sites..." + +*done* + +Please always add all authors, contributors and copyright holders in the +Authors@R field with the appropriate roles. + +*I have added Hoffmann La Roche to the Authors@R field and assigned cph* +*role to the institution and myself. This reflects our internal policy.* +*as stated in the licence file.* +*COPYRIGHT HOLDER: F. Hoffmann-La Roche Ltd and simaerep authors* +*This covers copyright interest of potential future external collaborators.* + +## Examples + +Please unwrap the examples if they are executable in < 5 sec, or replace +dontrun{} with \donttest{}. +*done, with one exception in the sim_studies() example show casing parallel* +*processing which makes changes to the user's environment.* + +Please replace if(interactive()){} with \donttest or unwrap the +examples. +*done, with one exception, with_progress_cnd() the progressbar is only visible* +*in interactive mode* + +## Console Messages + +R/lint.R + +*lint_package() has been declared an internal function, print() calls have been* +*exchanged for message() calls* + +R/simaerep_plot.R +*print() calls have been exchanged for message() calls that inform user that* +*certain element of the plot cannot be generated* + +## Seed +R/simaerep_plot.R +*seed can now be passed as parameter, fixed seed is desired so that the generated* +*plot always looks the same* + + + + # First Submission of simaerep ## Test Results diff --git a/docs/articles/check_poisson.html b/docs/articles/check_poisson.html index 0ead227..72bdd09 100644 --- a/docs/articles/check_poisson.html +++ b/docs/articles/check_poisson.html @@ -198,7 +198,7 @@

Test Data and Standard Processingdf_sim_sites <- sim_sites(df_site, df_visit) df_visit -
## # A tibble: 58,219 × 9
+
## # A tibble: 58,075 × 9
 ##    patnum  site_number is_ur max_visit_mean max_visit_sd ae_per_visit_mean visit
 ##    <chr>   <chr>       <lgl>          <dbl>        <dbl>             <dbl> <int>
 ##  1 P000001 S0001       TRUE              20            4              0.25     1
@@ -211,38 +211,38 @@ 

Test Data and Standard Processing## 8 P000001 S0001 TRUE 20 4 0.25 8 ## 9 P000001 S0001 TRUE 20 4 0.25 9 ## 10 P000001 S0001 TRUE 20 4 0.25 10 -## # … with 58,209 more rows, and 2 more variables: n_ae <int>, study_id <chr>

+## # … with 58,065 more rows, and 2 more variables: n_ae <int>, study_id <chr>
 df_site
## # A tibble: 300 × 6
 ##    study_id      site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_me…
 ##    <chr>         <chr>       <int>            <int>       <dbl>            <dbl>
-##  1 ae_per_visit… S0001          10               10          14            0.6  
-##  2 ae_per_visit… S0002          10               10          15            0.4  
-##  3 ae_per_visit… S0003          10               10          15            0.4  
-##  4 ae_per_visit… S0004          10               10          16            0.4  
-##  5 ae_per_visit… S0005          10               10          18            0.4  
-##  6 ae_per_visit… S0006          10                9          14            0.222
-##  7 ae_per_visit… S0007          10                9          14            0.444
-##  8 ae_per_visit… S0008          10                9          14            0.111
-##  9 ae_per_visit… S0009          10                8          17            0.375
-## 10 ae_per_visit… S0010          10                9          17            0.333
+##  1 ae_per_visit… S0001          10               10          17            0.6  
+##  2 ae_per_visit… S0002          10                9          17            0.444
+##  3 ae_per_visit… S0003          10                8          18            0.5  
+##  4 ae_per_visit… S0004          10                7          21            0.286
+##  5 ae_per_visit… S0005          10                8          16            0.625
+##  6 ae_per_visit… S0006          10                8          17            0    
+##  7 ae_per_visit… S0007          10               10          15            0.6  
+##  8 ae_per_visit… S0008          10               10          14            0.2  
+##  9 ae_per_visit… S0009          10                8          16            0.5  
+## 10 ae_per_visit… S0010          10                9          16            0.222
 ## # … with 290 more rows
 df_sim_sites
## # A tibble: 300 × 10
 ##    study_id      site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_me…
 ##    <chr>         <chr>       <int>            <int>       <dbl>            <dbl>
-##  1 ae_per_visit… S0001          10               10          14            0.6  
-##  2 ae_per_visit… S0002          10               10          15            0.4  
-##  3 ae_per_visit… S0003          10               10          15            0.4  
-##  4 ae_per_visit… S0004          10               10          16            0.4  
-##  5 ae_per_visit… S0005          10               10          18            0.4  
-##  6 ae_per_visit… S0006          10                9          14            0.222
-##  7 ae_per_visit… S0007          10                9          14            0.444
-##  8 ae_per_visit… S0008          10                9          14            0.111
-##  9 ae_per_visit… S0009          10                8          17            0.375
-## 10 ae_per_visit… S0010          10                9          17            0.333
+##  1 ae_per_visit… S0001          10               10          17            0.6  
+##  2 ae_per_visit… S0002          10                9          17            0.444
+##  3 ae_per_visit… S0003          10                8          18            0.5  
+##  4 ae_per_visit… S0004          10                7          21            0.286
+##  5 ae_per_visit… S0005          10                8          16            0.625
+##  6 ae_per_visit… S0006          10                8          17            0    
+##  7 ae_per_visit… S0007          10               10          15            0.6  
+##  8 ae_per_visit… S0008          10               10          14            0.2  
+##  9 ae_per_visit… S0009          10                8          16            0.5  
+## 10 ae_per_visit… S0010          10                9          16            0.222
 ## # … with 290 more rows, and 4 more variables: mean_ae_study_med75 <dbl>,
 ## #   n_pat_with_med75_study <int>, pval <dbl>, prob_low <dbl>
@@ -276,16 +276,16 @@

Simulate Studies## # A tibble: 30,000 × 8 ## r study_id site_number visit_med75 n_pat_with_med75 n_pat_study pval ## <dbl> <chr> <chr> <dbl> <int> <dbl> <dbl> -## 1 1 ae_per_visi… S0001 14 10 940 1 -## 2 1 ae_per_visi… S0002 15 10 895 0.545 -## 3 1 ae_per_visi… S0003 15 10 895 0.850 -## 4 1 ae_per_visi… S0004 16 10 847 0.850 -## 5 1 ae_per_visi… S0005 18 10 685 0.860 -## 6 1 ae_per_visi… S0006 14 9 941 1 -## 7 1 ae_per_visi… S0007 14 9 941 1 -## 8 1 ae_per_visi… S0008 14 9 941 0.394 -## 9 1 ae_per_visi… S0009 17 8 777 1 -## 10 1 ae_per_visi… S0010 17 9 776 1 +## 1 1 ae_per_visi… S0001 17 10 736 1 +## 2 1 ae_per_visi… S0002 17 9 737 1 +## 3 1 ae_per_visi… S0003 18 8 656 1 +## 4 1 ae_per_visi… S0004 21 7 372 0.838 +## 5 1 ae_per_visi… S0005 16 8 811 0.539 +## 6 1 ae_per_visi… S0006 17 8 738 1 +## 7 1 ae_per_visi… S0007 15 10 868 1 +## 8 1 ae_per_visi… S0008 14 10 915 1 +## 9 1 ae_per_visi… S0009 16 8 811 1 +## 10 1 ae_per_visi… S0010 16 9 810 0.839 ## # … with 29,990 more rows, and 1 more variable: prob_low <dbl>
@@ -306,16 +306,16 @@

Check p-value Probabilities## # A tibble: 300 × 11 ## study_id site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_me… ## <chr> <chr> <int> <int> <dbl> <dbl> -## 1 ae_per_visit… S0001 10 10 14 0.6 -## 2 ae_per_visit… S0002 10 10 15 0.4 -## 3 ae_per_visit… S0003 10 10 15 0.4 -## 4 ae_per_visit… S0004 10 10 16 0.4 -## 5 ae_per_visit… S0005 10 10 18 0.4 -## 6 ae_per_visit… S0006 10 9 14 0.222 -## 7 ae_per_visit… S0007 10 9 14 0.444 -## 8 ae_per_visit… S0008 10 9 14 0.111 -## 9 ae_per_visit… S0009 10 8 17 0.375 -## 10 ae_per_visit… S0010 10 9 17 0.333 +## 1 ae_per_visit… S0001 10 10 17 0.6 +## 2 ae_per_visit… S0002 10 9 17 0.444 +## 3 ae_per_visit… S0003 10 8 18 0.5 +## 4 ae_per_visit… S0004 10 7 21 0.286 +## 5 ae_per_visit… S0005 10 8 16 0.625 +## 6 ae_per_visit… S0006 10 8 17 0 +## 7 ae_per_visit… S0007 10 10 15 0.6 +## 8 ae_per_visit… S0008 10 10 14 0.2 +## 9 ae_per_visit… S0009 10 8 16 0.5 +## 10 ae_per_visit… S0010 10 9 16 0.222 ## # … with 290 more rows, and 5 more variables: mean_ae_study_med75 <dbl>, ## # n_pat_with_med75_study <int>, pval <dbl>, prob_low <dbl>, pval_ecd <dbl>
@@ -344,16 +344,16 @@ 

Perform Same Check on
## # A tibble: 300 × 11
 ##    study_id      site_number n_pat n_pat_with_med75 visit_med75 mean_ae_site_me…
 ##    <chr>         <chr>       <int>            <int>       <dbl>            <dbl>
-##  1 ae_per_visit… S0001          10               10          14            0.6  
-##  2 ae_per_visit… S0002          10               10          15            0.4  
-##  3 ae_per_visit… S0003          10               10          15            0.4  
-##  4 ae_per_visit… S0004          10               10          16            0.4  
-##  5 ae_per_visit… S0005          10               10          18            0.4  
-##  6 ae_per_visit… S0006          10                9          14            0.222
-##  7 ae_per_visit… S0007          10                9          14            0.444
-##  8 ae_per_visit… S0008          10                9          14            0.111
-##  9 ae_per_visit… S0009          10                8          17            0.375
-## 10 ae_per_visit… S0010          10                9          17            0.333
+##  1 ae_per_visit… S0001          10               10          17            0.6  
+##  2 ae_per_visit… S0002          10                9          17            0.444
+##  3 ae_per_visit… S0003          10                8          18            0.5  
+##  4 ae_per_visit… S0004          10                7          21            0.286
+##  5 ae_per_visit… S0005          10                8          16            0.625
+##  6 ae_per_visit… S0006          10                8          17            0    
+##  7 ae_per_visit… S0007          10               10          15            0.6  
+##  8 ae_per_visit… S0008          10               10          14            0.2  
+##  9 ae_per_visit… S0009          10                8          16            0.5  
+## 10 ae_per_visit… S0010          10                9          16            0.222
 ## # … with 290 more rows, and 5 more variables: mean_ae_study_med75 <dbl>,
 ## #   n_pat_with_med75_study <int>, pval <dbl>, prob_low <dbl>,
 ## #   prob_low_ecd <dbl>
diff --git a/docs/articles/check_poisson_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/check_poisson_files/figure-html/unnamed-chunk-4-1.png index 8755d86..7e182d0 100644 Binary files a/docs/articles/check_poisson_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/check_poisson_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/check_poisson_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/check_poisson_files/figure-html/unnamed-chunk-5-1.png index ebf8479..f67ec5c 100644 Binary files a/docs/articles/check_poisson_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/check_poisson_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/portfolio_perf.html b/docs/articles/portfolio_perf.html index b63d46e..0b46b34 100644 --- a/docs/articles/portfolio_perf.html +++ b/docs/articles/portfolio_perf.html @@ -243,162 +243,162 @@

Portfolio Configuration 0001 -0.3840118 +0.3881814 0001 -3.888730 -21.3 +3.205897 +20.5 10 0001 -0.3840118 +0.3881814 0002 -5.533735 -19.8 +4.458450 +20.9 10 0001 -0.3840118 +0.3881814 0003 -3.938415 -20.2 +4.115013 +21.4 10 0001 -0.3840118 +0.3881814 0004 -3.823901 -20.8 +4.270051 +19.7 10 0001 -0.3840118 +0.3881814 0005 -2.798809 -18.5 +2.359378 +18.3 10 0001 -0.3840118 +0.3881814 0006 -4.762119 -21.3 +4.301163 +18.5 10 0001 -0.3840118 +0.3881814 0007 -2.233582 -22.1 +3.190263 +18.8 10 0001 -0.3840118 +0.3881814 0008 -3.966527 -19.2 +5.015531 +19.4 10 0001 -0.3840118 +0.3881814 0009 -4.547282 -19.7 +3.107339 +20.1 10 0001 -0.3840118 +0.3881814 0010 -5.033223 -21.0 +3.301515 +18.7 10 0002 -0.4677083 +0.4847095 0001 -4.306326 -19.9 +3.871549 +19.1 10 0002 -0.4677083 +0.4847095 0002 -4.894441 -19.2 +4.067486 +16.9 10 0002 -0.4677083 +0.4847095 0003 -5.657836 -18.3 +5.557777 +21.0 10 0002 -0.4677083 +0.4847095 0004 -2.905933 -19.0 +2.440401 +20.8 10 0002 -0.4677083 +0.4847095 0005 -3.407508 -20.5 +3.205897 +21.5 10 0002 -0.4677083 +0.4847095 0006 -3.777124 -19.4 +2.299758 +20.2 10 0002 -0.4677083 +0.4847095 0007 -5.296749 -19.5 +3.348300 +17.9 10 0002 -0.4677083 +0.4847095 0008 -2.951459 -18.4 +5.316641 +19.6 10 0002 -0.4677083 +0.4847095 0009 -4.372896 -19.3 +3.164034 +19.7 10 0002 -0.4677083 +0.4847095 0010 -4.169999 -18.5 +2.877113 +19.5 10 @@ -439,253 +439,253 @@

Simulate Portfolio from Configura 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 1 -1 +0 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 2 -1 +0 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 3 1 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 4 1 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 5 1 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 6 -1 +4 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 7 -1 +4 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 8 -1 +4 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 9 -2 +4 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 10 -3 +6 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 11 -4 +6 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 12 -5 +6 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 13 -9 +6 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0001 14 -10 +6 0001 -0.3840118 -0001 -3.88873 -21.3 +0.3881814 0001 -15 -11 +3.205897 +20.5 +0002 +1 +0 0001 -0.3840118 -0001 -3.88873 -21.3 +0.3881814 0001 -16 -12 +3.205897 +20.5 +0002 +2 +1 0001 -0.3840118 -0001 -3.88873 -21.3 +0.3881814 0001 -17 -12 +3.205897 +20.5 +0002 +3 +1 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 -0001 -18 -13 +3.205897 +20.5 +0002 +4 +2 0001 -0.3840118 -0001 -3.88873 -21.3 +0.3881814 0001 -19 -15 +3.205897 +20.5 +0002 +5 +2 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0002 -1 -0 +6 +2 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0002 +7 2 -0 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0002 -3 -0 +8 +2 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0002 -4 -1 +9 +3 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0002 -5 -2 +10 +4 0001 -0.3840118 +0.3881814 0001 -3.88873 -21.3 +3.205897 +20.5 0002 -6 -2 +11 +5 @@ -1067,7 +1067,7 @@

Simulate Portfolio622 0001 2 -0 +1 0001 @@ -1080,7 +1080,7 @@

Simulate Portfolio622 0001 3 -0 +2 0001 @@ -1093,7 +1093,7 @@

Simulate Portfolio622 0001 4 -0 +2 0001 @@ -1106,7 +1106,7 @@

Simulate Portfolio622 0001 5 -0 +3 0001 @@ -1119,7 +1119,7 @@

Simulate Portfolio622 0001 6 -2 +3 0001 @@ -1132,7 +1132,7 @@

Simulate Portfolio622 0001 7 -3 +4 0001 @@ -1145,7 +1145,7 @@

Simulate Portfolio622 0001 8 -3 +4 0001 @@ -1171,7 +1171,7 @@

Simulate Portfolio622 0001 10 -5 +4 0001 @@ -1184,7 +1184,7 @@

Simulate Portfolio622 0001 11 -7 +4 0001 @@ -1197,7 +1197,7 @@

Simulate Portfolio622 0001 12 -7 +4 0001 @@ -1210,7 +1210,7 @@

Simulate Portfolio622 0001 13 -8 +4 0001 @@ -1223,7 +1223,7 @@

Simulate Portfolio622 0001 14 -9 +4 0001 @@ -1236,7 +1236,7 @@

Simulate Portfolio622 0001 15 -9 +5 0001 @@ -1249,7 +1249,7 @@

Simulate Portfolio622 0001 16 -10 +6 0001 @@ -1262,7 +1262,7 @@

Simulate Portfolio622 0001 17 -10 +6 0001 @@ -1275,7 +1275,7 @@

Simulate Portfolio622 0001 18 -10 +6 0001 @@ -1288,7 +1288,7 @@

Simulate Portfolio622 0001 19 -10 +6 0001 @@ -1301,7 +1301,7 @@

Simulate Portfolio622 0001 20 -10 +7 0001 @@ -1314,7 +1314,7 @@

Simulate Portfolio622 0001 21 -10 +7 0001 @@ -1325,9 +1325,9 @@

Simulate Portfolio22.5 622 622 -0001 -22 -10 +0002 +1 +0 0001 @@ -1339,8 +1339,8 @@

Simulate Portfolio622 622 0002 -1 -1 +2 +0 0001 @@ -1352,8 +1352,8 @@

Simulate Portfolio622 622 0002 -2 -2 +3 +0 0001 @@ -1365,8 +1365,8 @@

Simulate Portfolio622 622 0002 -3 -2 +4 +1 @@ -4407,16 +4407,16 @@

Heuristic Rank## # A tibble: 15,674 × 6 ## study_id site_number visit n_ae ae_per_visit ls_study_ae_per_visit ## <chr> <chr> <int> <int> <dbl> <list> -## 1 0001 0001 45 18 0.4 <dbl [43]> -## 2 0001 0002 64 17 0.266 <dbl [43]> -## 3 0001 0003 75 13 0.173 <dbl [43]> -## 4 0001 0004 175 44 0.251 <dbl [43]> -## 5 0001 0005 30 3 0.1 <dbl [43]> -## 6 0001 0006 35 9 0.257 <dbl [43]> -## 7 0001 0007 36 10 0.278 <dbl [43]> -## 8 0001 0008 191 74 0.387 <dbl [43]> -## 9 0001 0009 40 11 0.275 <dbl [43]> -## 10 0001 0010 135 38 0.281 <dbl [43]> +## 1 0001 0001 44 12 0.273 <dbl [43]> +## 2 0001 0002 55 20 0.364 <dbl [43]> +## 3 0001 0003 77 16 0.208 <dbl [43]> +## 4 0001 0004 241 69 0.286 <dbl [43]> +## 5 0001 0005 30 8 0.267 <dbl [43]> +## 6 0001 0006 35 6 0.171 <dbl [43]> +## 7 0001 0007 36 9 0.25 <dbl [43]> +## 8 0001 0008 179 40 0.223 <dbl [43]> +## 9 0001 0009 40 12 0.3 <dbl [43]> +## 10 0001 0010 133 42 0.316 <dbl [43]> ## # … with 15,664 more rows

We write a function that: - determines how many sites should be flagged in a study - pools ae_per_visit rates and ranks sites (using @@ -4472,12 +4472,12 @@

Heuristic Rank## # A tibble: 6 × 3 ## ur_rate ae_per_visit is_ur ## <dbl> <dbl> <lgl> -## 1 0 0.4 FALSE -## 2 0.1 0.36 FALSE -## 3 0.25 0.3 FALSE -## 4 0.5 0.2 FALSE -## 5 0.75 0.1 TRUE -## 6 1 0 TRUE +## 1 0 0.273 FALSE +## 2 0.1 0.245 FALSE +## 3 0.25 0.205 FALSE +## 4 0.5 0.136 TRUE +## 5 0.75 0.0682 TRUE +## 6 1 0 TRUE

We apply.

 progressr::with_progress(
diff --git a/docs/articles/portfolio_perf_files/figure-html/check_portf-1.png b/docs/articles/portfolio_perf_files/figure-html/check_portf-1.png
index 43ded92..db825c6 100644
Binary files a/docs/articles/portfolio_perf_files/figure-html/check_portf-1.png and b/docs/articles/portfolio_perf_files/figure-html/check_portf-1.png differ
diff --git a/docs/articles/portfolio_perf_files/figure-html/check_portf-2.png b/docs/articles/portfolio_perf_files/figure-html/check_portf-2.png
index a20e4ae..1650373 100644
Binary files a/docs/articles/portfolio_perf_files/figure-html/check_portf-2.png and b/docs/articles/portfolio_perf_files/figure-html/check_portf-2.png differ
diff --git a/docs/articles/portfolio_perf_files/figure-html/check_portf_2-1.png b/docs/articles/portfolio_perf_files/figure-html/check_portf_2-1.png
index 445c445..2f8aeb3 100644
Binary files a/docs/articles/portfolio_perf_files/figure-html/check_portf_2-1.png and b/docs/articles/portfolio_perf_files/figure-html/check_portf_2-1.png differ
diff --git a/docs/authors.html b/docs/authors.html
index b696a0d..7b1f0ff 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -92,7 +92,11 @@ 

Authors

  • -

    Bjoern Koneswarakantha. Author, maintainer. +

    Bjoern Koneswarakantha. Author, maintainer, copyright holder. +

    +
  • +
  • +

    F. Hoffmann-La Roche Ltd. Copyright holder.

@@ -105,11 +109,11 @@

Citation

Koneswarakantha B (2023). -simaerep: Simulate Adverse Event Reporting in Clinical Trials with the Goal of Detecting under-Reporting Sites. +simaerep: Find Clinical Trial Sites Under-Reporting Adverse Events. https://openpharma.github.io/simaerep/, https://github.com/openpharma/simaerep.

@Manual{,
-  title = {simaerep: Simulate Adverse Event Reporting in Clinical Trials with the Goal of Detecting under-Reporting Sites},
+  title = {simaerep: Find Clinical Trial Sites Under-Reporting Adverse Events},
   author = {Bjoern Koneswarakantha},
   year = {2023},
   note = {https://openpharma.github.io/simaerep/, https://github.com/openpharma/simaerep},
diff --git a/docs/index.html b/docs/index.html
index 7954e16..37b1df4 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,7 +5,7 @@
 
 
 
-Simulate Adverse Event Reporting in Clinical Trials with the Goal of Detecting under-Reporting Sites • simaerep
+Find Clinical Trial Sites Under-Reporting Adverse Events • simaerep
 
 
 
@@ -17,11 +17,12 @@
 
 
 
-
-
+
+