Skip to content

Commit

Permalink
when mean_ae_site_med75 == mean_ae_study_med75 overreporting must be 0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
erblast committed Mar 27, 2024
1 parent 993510f commit 4f1acd1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 26 deletions.
9 changes: 8 additions & 1 deletion R/simaerep.R
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,14 @@ eval_sites <- function(df_sim_sites,

if (! under_only) {
df_out <- df_out %>%
mutate(prob_high = 1 - .data$prob_low) %>%
mutate(
prob_high = 1 - .data$prob_low,
prob_high = ifelse(
.data$mean_ae_site_med75 == .data$mean_ae_study_med75,
1,
.data$prob_high
)
) %>%
arrange(.data$study_id, .data$prob_high) %>%
mutate(
prob_high_adj = p.adjust(.data$prob_high, method = method),
Expand Down
42 changes: 20 additions & 22 deletions docs/articles/over.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/articles/over_files/figure-html/unnamed-chunk-12-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions tests/testthat/test_over_reporting.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,23 @@ test_that("simaerep() - under_only = FALSE return over-reporting statistics", {
))

})

test_that(paste("simaerep() - under_only = FALSE - over-reporting must be zero when",
"mean_ae_site_med75 == mean_ae_study_med75"), {

df_visit <- sim_test_data_study(
ae_per_visit_mean = 0
) %>%
mutate(study_id = "A")

aerep <- simaerep(df_visit, under_only = FALSE)

zeros <- aerep$df_eval %>%
filter(mean_ae_study_med75 == mean_ae_site_med75) %>%
summarise(across(c(prob_low_prob_ur, prob_high_prob_or), sum)) %>%
summarise(across(c(prob_low_prob_ur, prob_high_prob_or), ~ . == 0)) %>%
unlist()

expect_true(all(zeros))

})
5 changes: 2 additions & 3 deletions vignettes/over.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ setdiff(colnames(aerep_ovr$df_eval), colnames(aerep_def$df_eval))

# Analyze

## Probability getting a lower or equal AE count
## Probability getting a lower AE count


```{r}
Expand Down Expand Up @@ -107,11 +107,10 @@ ggExtra::ggMarginal(p, groupColour = TRUE, type = "density")

We can see that we have a gap for the default setting in the generated probabilities. The values filling the gap can be interpreted as the probability of having a `higher` site average than originally observed.

We need to be aware that values in the simulation `equal` to the site mean will count towards the under-reporting probability. This can potentially lead to artifacts with low AE counts.

## Over-Reporting

We can add the over-reporting probability as (1- under-reporting probability)
We can add the over-reporting probability as (1- under-reporting probability), for cases when mean_ae_site_med75 is equal to mean_ae_study_med75 over-reporting probability will always be zero.

```{r}
Expand Down

0 comments on commit 4f1acd1

Please sign in to comment.