Skip to contents

predict() reads the cumulative incidence curves of an aalen_johansen() fit at given times. Each curve is a right-continuous step function that is 0 before the first event.

Usage

# S3 method for class 'aalen_johansen'
predict(object, times, ...)

Arguments

object

An aalen_johansen() fit.

times

The times to read the curves at.

...

Unused.

Value

A data frame with one row per group, cause, and time: strata, the grouping variables, cause, time, estimate, std_error, conf_low, and conf_high.

Examples

mgus <- data.frame(
  time = c(30, 45, 60, 72, 80, 95, 110, 120, 130, 150, 160, 180),
  status = c(1, 2, 0, 2, 1, 2, 0, 1, 2, 2, 0, 1)
)
mgus$event <- factor(mgus$status, levels = 0:2, labels = c("censor", "pcm", "death"))
fit <- aalen_johansen(Surv(time, event) ~ 1, data = mgus)
predict(fit, times = c(25, 100, 200))
#>   strata cause time  estimate std_error    conf_low conf_high
#> 1    all   pcm   25 0.0000000 0.0000000 0.000000000 0.0000000
#> 2    all   pcm  100 0.1759259 0.1133288 0.000000000 0.3980462
#> 3    all   pcm  200 0.5092593 0.1588187 0.197980297 0.8205382
#> 4    all death   25 0.0000000 0.0000000 0.000000000 0.0000000
#> 5    all death  100 0.2685185 0.1330476 0.007750005 0.5292870
#> 6    all death  200 0.4907407 0.1588187 0.179461778 0.8020197