simaerep icon indicating copy to clipboard operation
simaerep copied to clipboard

Potentially incorrect equation mark comparing site mean to study mean

Open richb123 opened this issue 1 year ago • 1 comments

     prob_high = ifelse(
        .data$mean_ae_site_med75 == .data$mean_ae_study_med75,
        1,
        .data$prob_high
      )

https://github.com/openpharma/simaerep/blob/dd5e9e7d39d20c4069775526ea2303d5c3120175/R/simaerep.R#L417

In this line we are setting the probability to 1 for site means which are equal (==) to study mean. If we look on similar block of code for under reporting (starting on line 689, see snippet below), I believe the intent is to "filter out" sites which are either above or below the study mean.

if (under_only) { # we are not interested in cases where site AE is greater study AE if (mean_ae_site > mean_ae_study) { prob_lower <- 1 return(prob_lower) } }

richb123 avatar May 06 '24 14:05 richb123

Hello,

this line is meant to make sure that over-reporting probability ends up being zero in cases when study and site mean are equal. This fixes cases in which sites with 0 AEs were flagged as over-reporting.

The behaviour is tested for in unit test "simaerep() - under_only = FALSE - over-reporting must be zero when mean_ae_site_med75 == mean_ae_study_med75" in file test_over_reporting.R

The condition could also be expressed like that, mean_ae_site_med75 == 0 & mean_ae_study_med75 == 0

We might change this in the future to make the purpose of this line more clear.

erblast avatar May 22 '24 11:05 erblast