kaigu1990 / stabiot

Common Statistical Analysis for Clinical Trials in Biotech
GNU General Public License v3.0
2 stars 0 forks source link

[Bug]: BOR with confirmation in onco_resp.R #36

Open ccctingting opened 2 days ago

ccctingting commented 2 days ago

In the code below,

group_by(!!sym(unique_id)) %>%
filter(
  row_number() <= min(match(TRUE, .data$flag))
)

keeping only the first record where the flag is 'TRUE' prevents the detection of subsequent CRs, such as in the following scenario, for new added subject 9, the BOR should be CR not PR

adrs <- tibble::tribble(
  ~USUBJID, ~TRTSDTC,     ~ADTC,        ~AVALC,
  "9",      "2020-01-01", "2020-01-01", "PR",
  "9",      "2020-01-01", "2020-02-01", "CR",
  "9",      "2020-01-01", "2020-02-16", "NE",
  "9",      "2020-01-01", "2020-03-01", "CR",
  "9",      "2020-01-01", "2020-04-01", "CR"
) %>%
  dplyr::mutate(
    ADT = lubridate::ymd(ADTC),
    TRTSDT = lubridate::ymd(TRTSDTC),
    PARAMCD = "OVR",
    PARAM = "Overall Response by Investigator"
  ) %>%
  dplyr::select(-TRTSDTC)

derive_bor(data = adrs, ref_start_window = 28, ref_interval = 28, confirm = TRUE,max_ne = 0)

# A tibble: 1 × 8
  USUBJID ADTC       AVALC ADT        TRTSDT     PARAMCD PARAM                            AVAL
  <chr>   <chr>      <chr> <date>     <date>     <chr>   <chr>                           <dbl>
1 9       2020-01-01 PR    2020-01-01 2020-01-01 CBOR    Confirmed Best Overall Response     2
kaigu1990 commented 2 days ago

Hi @ccctingting, In this scenario, I feel you should specify the max_ne = 1 so that the first CR can be confirmed by the second CR as one NE is allowed between them.

derive_bor(data = adrs, ref_start_window = 28, ref_interval = 28, confirm = TRUE, max_ne = 1)

# A tibble: 1 × 8
  USUBJID ADTC       AVALC ADT        TRTSDT     PARAMCD PARAM                     AVAL
  <chr>   <chr>      <chr> <date>     <date>     <chr>   <chr>                    <dbl>
1 9       2020-02-01 CR    2020-02-01 2020-01-01 CBOR    Confirmed Best Overall …     1

And regarding your suggestion, I think the current code has considered filtering the first observation, like the subsequent CR at least 28 days later. Or do you have an example data that I can check the code again?

ccctingting commented 12 hours ago

Hi @kaigu1990 , my point is that the program focuses on first CR sequence, CR-NE-CR , it stops searching for the second CR. For instance, a CR-CR sequence from 2020-03-01 to 2020-04-01 should also be considered a confirmed CR.