MSKCC-Epi-Bio/tidycmprsk

Bug in `n.censor` and `n.event` calculation when specifying `tidy(times=)`

Closed this issue · 0 comments

The table below shows calculations past the max observed followup times. The final number in the cum. should match the total of the n. columns.

tidycmprsk::cuminc(tidycmprsk::Surv(ttdeath, death_cr) ~ 1, data = tidycmprsk::trial) |> 
  tidycmprsk::tidy(times = 0:4 * 10) |> 
  dplyr::filter(outcome %in% "death from cancer") |> 
  dplyr::select(time, n.event, cum.event, n.censor, cum.censor)
#> # A tibble: 5 × 5
#>    time n.event cum.event n.censor cum.censor
#>   <dbl>   <int>     <int>    <int>      <int>
#> 1     0       0         0        0          0
#> 2    10       6         6        0          0
#> 3    20      37        43        0          0
#> 4    30       0        57        0         88
#> 5    40       0        57        0         88

Created on 2022-08-11 by the reprex package (v2.0.1)

The results should look like this:
image