Skip to contents

score_cr() gives the main measures of a competing-risks prediction in one table: the concordance at tau, with its confidence interval (see concordance_index_ci()), the Brier score at each time, and the integrated Brier score (see brier_score_incidence()). The concordance uses the predictions at the last of times that is at or before tau (or the first time, if all are later).

Usage

score_cr(response, incidence_prob, cause, times, tau = NULL, conf_level = 0.95)

Arguments

response

A competing-risks Surv() object, Surv(time, event) with event a factor whose first level means censored and whose other levels are the causes.

incidence_prob

The predicted cumulative incidence of cause. For concordance_index_incidence(), one value per subject (such as the incidence at a fixed time). Otherwise a matrix with one row per subject and one column per time.

cause

The cause, as a level of event or its number (1 for the first cause).

times

The times, in increasing order, of the columns of incidence_prob. At least two.

tau

The truncation time of the concordance. The default is the last of times.

conf_level

The confidence level of the concordance's interval. The default is 0.95.

Value

A data frame with one row per measure: metric ("concordance", then "brier(t)" for each time t, then "integrated_brier"), estimate, and, for the concordance only, 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),
  age = c(62, 75, 58, 80, 66, 71, 59, 64, 77, 82, 60, 68)
)
mgus$event <- factor(mgus$status, levels = 0:2, labels = c("censor", "pcm", "death"))

fit <- fine_gray(Surv(time, event) ~ age, data = mgus, cause = "pcm")
times <- c(50, 100, 150)
p <- predict(fit, newdata = mgus, type = "cif", times = times)
probs <- matrix(p$estimate, ncol = length(times), byrow = TRUE)

score_cr(Surv(mgus$time, mgus$event), incidence_prob = probs, cause = "pcm", times = times)
#>             metric   estimate std_error  conf_low conf_high
#> 1      concordance 0.74602588 0.1292799 0.4354144 0.9179527
#> 2        brier(50) 0.07458136        NA        NA        NA
#> 3       brier(100) 0.14223452        NA        NA        NA
#> 4       brier(150) 0.15899196        NA        NA        NA
#> 5 integrated_brier 0.12951059        NA        NA        NA