Skip to contents

survival_boost() estimates the cumulative incidence of each cause, and the probability of being free of any event, as functions of time and the covariates, by multi-class gradient boosting (Alberge et al., 2025). At a time \(t\), each subject is in one of \(K + 1\) classes: still free of any event, or having had an event of cause \(k\) by \(t\). The model gives the probabilities of the classes as the softmax of \(K + 1\) scores, each a sum of regression trees on \(t\) and the covariates.

Usage

survival_boost(
  formula,
  data,
  subset,
  na.action = stats::na.omit,
  n_estimators = 100,
  learning_rate = 0.05,
  max_depth = 3,
  min_samples_leaf = 10,
  subsample = 1,
  max_features = NULL,
  n_time_grid_steps = 100,
  hard_zero_fraction = 0.1,
  n_horizons_per_observation = 3,
  epsilon_censoring = 0.05
)

Arguments

formula

A formula with a competing-risks response on the left, Surv(time, event) with event a factor whose first level is censoring, and the covariates on the right, such as Surv(time, event) ~ age + sex.

data

A data frame holding the variables in formula.

subset

An optional expression selecting the rows of data to use.

na.action

What to do with rows that have missing values. The default drops them.

n_estimators

The number of boosting rounds (trees), at least 1. The default is 100.

learning_rate

The shrinkage of each tree, a positive number. The default is 0.05.

max_depth

The largest depth of each tree, at least 1. The default is 3.

min_samples_leaf

The fewest rows in each leaf of a tree, at least 1. The default is 10.

subsample

The share of the rows (the subjects at their times \(\tau\)) each round's trees are grown on, greater than 0 and at most 1. The default is 1.

max_features

The number of columns (the time and the covariates) tried at each split: NULL (all of them, the default), "sqrt", "log2", a whole number, or a fraction between 0 and 1 of the columns.

n_time_grid_steps

The number of times in the default grid of predict(): the event times if there are no more of them than this, and otherwise this many of their quantiles. The default is 100.

hard_zero_fraction

The share of each round's times set to 0, at least 0 and below 1. The default is 0.1.

n_horizons_per_observation

The number of random times per subject in each round, at least 1. The default is 3.

epsilon_censoring

The smallest value of the censoring curve used in the weights, a positive number. The default is 0.05.

Value

A survival_boost object. Use predict() for the cumulative incidence of each cause and the probability of being free of any event. The object also holds times (the default times of the predictions), states (the causes), n, and n_event (the number of events of any cause).

Details

At each of n_estimators rounds, every subject gets n_horizons_per_observation random times \(\tau\), drawn uniformly up to the largest follow-up time, with a share hard_zero_fraction of them set to 0. A subject still under follow-up at \(\tau\) counts as event-free, weighted by \(1 / G(\tau)\). A subject with an event by \(\tau\) counts in the class of its cause, weighted by \(1 / G(T)\), with \(T\) its event time. A subject censored by \(\tau\) is left out. \(G\) is the Kaplan-Meier curve of the censoring times (with events tied with a censoring taken to come first), kept at least epsilon_censoring. These inverse-probability-of- censoring weights make up for the subjects left out. For each class, a regression tree on \((\tau, x)\) is then fit to the weighted gradient of the multi-class log loss, \(w (y_k - p_k)\), with \(p_k\) the current model's probability of the class at \((\tau, x)\). Each leaf of the tree takes a Newton step on the log loss, \(\frac{K}{K + 1} \sum w (y_k - p_k) / \sum w p_k (1 - p_k)\) over the rows in the leaf (Friedman, 2001), and the tree is added to the class's score, shrunk by learning_rate.

The model uses R's random number generator for the times, and for subsample and max_features (which work as in gradient_boosting_survival_analysis(), with the time counted as one of the covariates), so call set.seed() first for results that can be repeated.

References

Alberge, J., Maladiere, V., Grisel, O., Abecassis, J., and Varoquaux, G. (2025). Survival models: proper scoring rule and stochastic optimization with competing risks. Proceedings of the 28th International Conference on Artificial Intelligence and Statistics.

Friedman, J. H. (2001). Greedy function approximation: a gradient boosting machine. The Annals of Statistics, 29(5), 1189-1232.

See also

aalen_johansen() for the cumulative incidence without covariates, and fine_gray() for a regression model of it.

Examples

mgus <- data.frame(
  time = c(30, 45, 60, 72, 80, 95, 110, 120, 130, 150, 160, 180, 200, 210, 220, 240, 45, 95,
    35, 140),
  status = c(1, 2, 0, 2, 1, 2, 0, 1, 2, 2, 0, 1, 1, 2, 0, 2, 0, 1, 2, 1),
  age = c(62, 75, 58, 80, 66, 71, 59, 64, 77, 82, 60, 68, 55, 79, 63, 74, 70, 61, 81, 57),
  hgb = c(13, 12, 14, 11, 13, 12, 15, 12, 11, 10, 14, 13, 12, 11, 15, 12, 13, 12, 10, 14)
)
mgus$event <- factor(mgus$status, levels = 0:2, labels = c("censor", "pcm", "death"))

set.seed(1)
fit <- survival_boost(Surv(time, event) ~ age + hgb,
  data = mgus, n_estimators = 30, max_depth = 2, min_samples_leaf = 5
)
fit
#> <survival_boost> Surv(time, event) ~ age + hgb
#> 30 boosting rounds of 3 regression trees (one per class) of depth at most 2, learning rate 0.05.
#> Causes: pcm, death. n = 20, events = 15, features = 2

# The cumulative incidence of each cause for a new subject
predict(fit, newdata = data.frame(age = 75, hgb = 11), times = c(50, 150))
#>   subject cause time   estimate
#> 1       1   pcm   50 0.07666563
#> 2       1   pcm  150 0.09005431
#> 3       1 death   50 0.15644706
#> 4       1 death  150 0.60352173