You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When no patients have been censored, this Stack Overflow answer indicates that as long as the first level of the factor is censoring, cuminc will work properly, even if that level has not been observed.
However, this no longer appears to be the case. Example from the linked question:
library(tidycmprsk)
data<-trial %>%
dplyr::mutate(
death_cr_new=dplyr::case_when(
death_cr=="censor"~2,
death_cr=="death from cancer"~2,
death_cr=="death other causes"~3
) %>%
factor(levels=1:3)
)
data$death_cr_new %>% table()
#> .#> 1 2 3 #> 0 145 55
cuminc(Surv(ttdeath, death_cr_new) ~trt, data)
#> #> ── cuminc() ────────────────────────────────────────────────────────────────────#> • Failure type "3"#> strata time n.risk estimate std.error 95% CI #> Drug A 5.00 97 0.010 0.010 0.001, 0.050 #> Drug A 10.0 94 0.021 0.015 0.004, 0.066 #> Drug A 15.0 83 0.083 0.028 0.039, 0.150 #> Drug A 20.0 61 0.219 0.044 0.140, 0.310 #> Drug B 5.00 102 0.000 0.000 NA, NA #> Drug B 10.0 95 0.030 0.017 0.008, 0.079 #> Drug B 15.0 75 0.108 0.033 0.055, 0.181 #> Drug B 20.0 55 0.248 0.048 0.161, 0.346#> • Tests#> outcome statistic df p.value #> 3 0.032 1.00 0.86
Thanks! No hurry, I already have a silly workaround: if you add a row with the state set to censored and the time set to NA, it makes sure the censored level doesn't get dropped, while the row gets excluded from the analysis.
I fear I may be partly responsible as well 😅, the bug got introduced here #80, this line is the problem
When no patients have been censored, this Stack Overflow answer indicates that as long as the first level of the factor is censoring,
cuminc
will work properly, even if that level has not been observed.However, this no longer appears to be the case. Example from the linked question:
Created on 2023-02-07 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: