Broom methods for tidy cuminc objects
object of class 'tidycuminc'
Numeric vector of times to obtain risk estimates at
Logical indicating whether or not to include a confidence
interval in the tidied output. Defaults to FALSE
.
Level of the confidence interval. Default matches that in
cuminc(conf.level=)
(typically, 0.95)
not used
a tibble
tidy()
data frameThe returned tidy()
data frame returns the following columns:
Column Name | Description |
outcome | Competing Event Outcome |
time | Numeric follow-up time |
estimate | Risk estimate |
std.error | Standard Error |
n.risk | Number at risk at the specified time |
n.event | If the times= argument is missing, then the number of events that occurred at time t . Otherwise, it is the cumulative number of events that have occurred since the last time listed. |
n.censor | If the times= argument is missing, then the number of censored obs at time t . Otherwise, it is the cumulative number of censored obs that have occurred since the last time listed. |
cum.event | Cumulative number of events at specified time |
cum.censor | Cumulative number of censored observations at specified time |
If tidy(time=)
is specified, then n.event
and n.censor
are the
cumulative number of events/censored in the interval. For example, if
tidy(time = c(0, 12, 18))
is passed, n.event
and n.censor
at time = 18
are the cumulative number of events/censored in the interval (12, 18]
.
The p-values reported in cuminc()
, glance.tidycuminc()
and add_p.tbl_cuminc()
are Gray's test as described in
Gray RJ (1988) A class of K-sample tests for comparing the cumulative incidence of a competing risk, Annals of Statistics, 16:1141-1154.
The confidence intervals for cumulative incidence estimates use the recommended method in Competing Risks: A Practical Perspective by Melania Pintilie.
$$x^{exp(±z * se / (x * log(x)))}$$
where \(x\) is the cumulative incidence estimate, \(se\) is the standard error estimate, and \(z\) is the z-score associated with the confidence level of the interval, e.g. \(z = 1.96\) for a 95% CI.
Other cuminc() functions:
cuminc()
cuminc <- cuminc(Surv(ttdeath, death_cr) ~ trt, trial)
tidy(cuminc)
#> # A tibble: 228 × 12
#> time outcome strata estim…¹ std.e…² conf.low conf.…³ n.risk n.event n.cen…⁴
#> <dbl> <chr> <fct> <dbl> <dbl> <dbl> <dbl> <int> <int> <int>
#> 1 0 death f… Drug A 0 0 NA NA 98 0 0
#> 2 3.53 death f… Drug A 0 0 NA NA 98 0 0
#> 3 7.27 death f… Drug A 0.0102 0.0102 8.84e-4 0.0503 97 1 0
#> 4 7.38 death f… Drug A 0.0204 0.0144 3.90e-3 0.0652 96 1 0
#> 5 8.37 death f… Drug A 0.0204 0.0144 3.90e-3 0.0652 95 0 0
#> 6 10.1 death f… Drug A 0.0204 0.0144 3.90e-3 0.0652 94 0 0
#> 7 10.3 death f… Drug A 0.0204 0.0144 3.90e-3 0.0652 93 0 0
#> 8 10.5 death f… Drug A 0.0204 0.0144 3.90e-3 0.0652 92 0 0
#> 9 11.4 death f… Drug A 0.0306 0.0175 8.17e-3 0.0798 91 1 0
#> 10 11.8 death f… Drug A 0.0306 0.0175 8.17e-3 0.0798 90 0 0
#> # … with 218 more rows, 2 more variables: cum.event <int>, cum.censor <int>,
#> # and abbreviated variable names ¹estimate, ²std.error, ³conf.high, ⁴n.censor
glance(cuminc)
#> # A tibble: 1 × 8
#> outcome_1 statistic_1 df_1 p.value_1 outcome_2 stati…¹ df_2 p.val…²
#> <chr> <dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl>
#> 1 death from cancer 1.99 1 0.159 death oth… 0.0886 1 0.766
#> # … with abbreviated variable names ¹statistic_2, ²p.value_2
# restructure glance to one line per outcome
glance(cuminc) %>%
tidyr::pivot_longer(
everything(),
names_to = c(".value", "outcome_id"),
names_pattern = "(.*)_(.*)"
)
#> # A tibble: 2 × 5
#> outcome_id outcome statistic df p.value
#> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 1 death from cancer 1.99 1 0.159
#> 2 2 death other causes 0.0886 1 0.766