Closed ddsjoberg closed 2 years ago
@ddsjoberg It is a bug in the labelling of the function. I will fix it.
Thank you @SHAESEN2 for taking a look!
There are two issues.
library(visR)
library(survival)
packageVersion("visR")
#> [1] '0.2.0'
# number of events to report at Day 20
survfit(Surv(AVAL, 1 - CNSR) ~ 1, adtte) |>
summary(times = 20) |>
purrr::pluck("n.event")
#> [1] 57
# number of censored obs to report at Day 20
survfit(Surv(AVAL, CNSR) ~ 1, adtte) |>
summary(times = 20) |>
purrr::pluck("n.event")
#> [1] 19
Created on 2022-01-09 by the reprex package (v2.0.1)
I think the calculation of the number of censored patients in
get_risktable.survfit()
is not correct.In the example below, we're focusing on the number of patients at risk, number of events, and the number of censored patients. In this setting the calculation of the number of events and the number of censored patients should be the same method.
In the example below,
summary.survfit()
indicates there are 57 events in the first 20 days (this includes day 20) and the tabulation at the bottom of the reprex confirms this is correct. However,get_risktable()
shows 57 CENSORED (not events) in the first 20 days.Also, assuming the censored and event labels are switched in
get_risktable()
, the number censored is not correct. The cross table at the bottom of the reprex shows that 19 patients were censored in the first 20 days (get_risktable()
shows 16).Created on 2022-01-07 by the reprex package (v2.0.1)