broom_methods_cuminc: Broom methods for tidy cuminc objects

broom_methods_cumincR Documentation

Broom methods for tidy cuminc objects

Description

Broom methods for tidy cuminc objects

Usage

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

## S3 method for class '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 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]⁠.

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)

glance(cuminc)

# restructure glance to one line per outcome
glance(cuminc) %>%
  tidyr::pivot_longer(
    everything(),
    names_to = c(".value", "outcome_id"),
    names_pattern = "(.*)_(.*)"
  )

tidycmprsk documentation built on Sept. 11, 2024, 7:24 p.m.