Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Possible bug with risk_diff (rtables/tern)? #213

Open
aassuied-ps opened this issue Mar 14, 2024 · 0 comments
Open

[Bug]: Possible bug with risk_diff (rtables/tern)? #213

aassuied-ps opened this issue Mar 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aassuied-ps
Copy link
Collaborator

What happened?

I'm not sure about the calculation that is done without using risk_diff (when the option is available).
Here's an example:

library(falcon)
library(dplyr)
packageVersion("falcon")

adsl <- random.cdisc.data::cadsl
adae <- random.cdisc.data::cadae

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_06(adae = adae, alt_counts_df = adsl, risk_diff = risk_diff)
make_table_06(adae = adae, alt_counts_df = adsl)

The output without using risk_diff does not seem to be right (to me). Got 104 SAE over 134 participants in A: group: i don't think the percentage shoult be 85.2%. When using risk_diff, the percentage is 77.6% (seems correct).

The output is displayed below.

Did I miss something? If it's a bug I could help to find the cause.

sessionInfo()

No response

Relevant log output

> library(falcon)
> library(dplyr)
> packageVersion("falcon")
[1] ‘0.1.0.9053> 
> adsl <- random.cdisc.data::cadsl
> adae <- random.cdisc.data::cadae
> # Output Table
> risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
> make_table_06(adae = adae, alt_counts_df = adsl, risk_diff = risk_diff)
                                                                       A: Drug X    B: Placebo    C: Combination   Risk Difference (%) (95% CI)
Event                                                                   (N=134)       (N=134)        (N=132)                 (N=268)           
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
SAE                                                                   104 (77.6%)   101 (75.4%)     99 (75.0%)          -2.2 (-12.4 - 7.9)     
  SAEs with fatal outcome                                             76 (56.7%)    70 (52.2%)      75 (56.8%)          -4.5 (-16.4 - 7.4)     
  Life-threatening SAEs                                                9 (6.7%)      13 (9.7%)      19 (14.4%)           3.0 (-3.6 - 9.5)      
  SAEs requiring hospitalization                                      24 (17.9%)    28 (20.9%)      30 (22.7%)          3.0 (-6.5 - 12.4)      
  SAEs resulting in substantial disruption of normal life functions   28 (20.9%)    21 (15.7%)      23 (17.4%)          -5.2 (-14.5 - 4.0)     
  Congenital anomaly or birth defect                                  26 (19.4%)    27 (20.1%)      20 (15.2%)          0.7 (-8.8 - 10.3)      
  Other                                                               30 (22.4%)    37 (27.6%)      32 (24.2%)          5.2 (-5.1 - 15.6)      
AE leading to permanent discontinuation of study drug                 27 (20.1%)    26 (19.4%)      30 (22.7%)          -0.7 (-10.3 - 8.8)     
AE leading to dose modification of study drug                         71 (53.0%)    86 (64.2%)      83 (62.9%)          11.2 (-0.5 - 22.9)     
  AE leading to interruption of study drug                             4 (3.0%)      4 (3.0%)        3 (2.3%)            0.0 (-4.1 - 4.1)      
  AE leading to reduction of study drug                               46 (34.3%)    46 (34.3%)      51 (38.6%)          0.0 (-11.4 - 11.4)     
  AE leading to dose delay of study drug                              20 (14.9%)    28 (20.9%)      30 (22.7%)          6.0 (-3.2 - 15.1)      
  Other                                                               34 (25.4%)    48 (35.8%)      46 (34.8%)          10.4 (-0.5 - 21.4)     
Any AE                                                                122 (91.0%)   123 (91.8%)    120 (90.9%)           0.7 (-6.0 - 7.5)      
  MILD                                                                 7 (5.2%)      9 (6.7%)        4 (3.0%)            1.5 (-4.2 - 7.2)      
  MODERATE                                                            24 (17.9%)    24 (17.9%)      23 (17.4%)           0.0 (-9.2 - 9.2)      
  SEVERE                                                              91 (67.9%)    90 (67.2%)      93 (70.5%)         -0.7 (-12.0 - 10.5)     
> make_table_06(adae = adae, alt_counts_df = adsl)
                                                                       A: Drug X    B: Placebo    C: Combination
Event                                                                   (N=134)       (N=134)        (N=132)    
————————————————————————————————————————————————————————————————————————————————————————————————————————————————
SAE                                                                   104 (85.2%)   101 (82.1%)     99 (82.5%)  
  SAEs with fatal outcome                                             76 (62.3%)    70 (56.9%)      75 (62.5%)  
  Life-threatening SAEs                                                9 (7.4%)     13 (10.6%)      19 (15.8%)  
  SAEs requiring hospitalization                                      24 (19.7%)    28 (22.8%)      30 (25.0%)  
  SAEs resulting in substantial disruption of normal life functions   28 (23.0%)    21 (17.1%)      23 (19.2%)  
  Congenital anomaly or birth defect                                  26 (21.3%)    27 (22.0%)      20 (16.7%)  
  Other                                                               30 (24.6%)    37 (30.1%)      32 (26.7%)  
AE leading to permanent discontinuation of study drug                 27 (22.1%)    26 (21.1%)      30 (25.0%)  
AE leading to dose modification of study drug                         71 (58.2%)    86 (69.9%)      83 (69.2%)  
  AE leading to interruption of study drug                             4 (3.3%)      4 (3.3%)        3 (2.5%)   
  AE leading to reduction of study drug                               46 (37.7%)    46 (37.4%)      51 (42.5%)  
  AE leading to dose delay of study drug                              20 (16.4%)    28 (22.8%)      30 (25.0%)  
  Other                                                               34 (27.9%)    48 (39.0%)      46 (38.3%)  
Any AE                                                                122 (91.0%)   123 (91.8%)    120 (90.9%)  
  MILD                                                                 7 (5.2%)      9 (6.7%)        4 (3.0%)   
  MODERATE                                                            24 (17.9%)    24 (17.9%)      23 (17.4%)  
  SEVERE                                                              91 (67.9%)    90 (67.2%)      93 (70.5%)
@aassuied-ps aassuied-ps added the bug Something isn't working label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant