Broom methods for tidy cuminc objects

# S3 method for tidycuminc
tidy(x, times = NULL, conf.int = TRUE, conf.level = x$conf.level, ...)

# S3 method for tidycuminc
glance(x, ...)

Arguments

x

object of class 'tidycuminc'

times

Numeric vector of times to obtain risk estimates at

conf.int

Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE.

conf.level

Level of the confidence interval. Default matches that in cuminc(conf.level=) (typically, 0.95)

...

not used

Value

a tibble

tidy() data frame

The returned tidy() data frame returns the following columns:

Column NameDescription
outcomeCompeting Event Outcome
timeNumeric follow-up time
estimateRisk estimate
std.errorStandard Error
n.riskNumber at risk at the specified time
n.eventIf 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.censorIf 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.eventCumulative number of events at specified time
cum.censorCumulative 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].

p-values

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.

Confidence intervals

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.

See also

Other cuminc() functions: cuminc()

Examples

cuminc <- cuminc(Surv(ttdeath, death_cr) ~ trt, trial)

tidy(cuminc)
#> # A tibble: 444 × 12
#>     time outcome     strata estimate std.error conf.low conf.high n.risk n.event
#>    <dbl> <chr>       <fct>     <dbl>     <dbl>    <dbl>     <dbl>  <int>   <int>
#>  1  0    death from… Drug A   0         0      NA         NA          98       0
#>  2  3.53 death from… Drug A   0         0      NA         NA          98       0
#>  3  5.33 death from… Drug A   0         0      NA         NA          97       0
#>  4  6.32 death from… Drug A   0         0      NA         NA          97       0
#>  5  7.27 death from… Drug A   0.0102    0.0102  8.84e-4    0.0503     97       1
#>  6  7.38 death from… Drug A   0.0204    0.0144  3.90e-3    0.0652     96       1
#>  7  8.37 death from… Drug A   0.0204    0.0144  3.90e-3    0.0652     95       0
#>  8  8.71 death from… Drug A   0.0204    0.0144  3.90e-3    0.0652     94       0
#>  9  9.24 death from… Drug A   0.0204    0.0144  3.90e-3    0.0652     94       0
#> 10  9.73 death from… Drug A   0.0204    0.0144  3.90e-3    0.0652     94       0
#> # ℹ 434 more rows
#> # ℹ 3 more variables: n.censor <int>, cum.event <int>, cum.censor <int>

glance(cuminc)
#> # A tibble: 1 × 8
#>   outcome_1    statistic_1  df_1 p.value_1 outcome_2 statistic_2  df_2 p.value_2
#>   <chr>              <dbl> <dbl>     <dbl> <chr>           <dbl> <dbl>     <dbl>
#> 1 death from …        1.99     1     0.159 death ot…      0.0886     1     0.766

# 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