Skip to contents

This learner estimates the Cumulative Incidence Function (CIF) for competing risks using the empirical Aalen-Johansen (AJ) estimator.

Transition probabilities to each competing event are computed from the training data via the survival::survfit.formula() function. Predictions are made at all unique event times (across all causes) observed in the training set.

Dictionary

This Learner can be instantiated via the dictionary mlr_learners or with the associated sugar function lrn():

mlr_learners$get("cmprsk.aalen")
lrn("cmprsk.aalen")

Meta Information

  • Task type: “cmprsk”

  • Predict Types: “cif”

  • Feature Types: “logical”, “integer”, “numeric”, “factor”

  • Required Packages: mlr3, mlr3cmprsk, survival

Parameters

Empty ParamSet

References

Aalen, O O, Johansen, Soren (1978). “An empirical transition matrix for non-homogeneous Markov chains based on censored observations.” Scandinavian journal of statistics, 141–150.

See also

Other competing risk learners: mlr_learners_cmprsk.fg

Super classes

mlr3::Learner -> mlr3cmprsk::LearnerCompRisks -> LearnerCompRisksAalenJohansen

Active bindings

native_model

(survival::survfit)
The fitted model.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method importance()

All features have a score of 0 for this learner. This method exists solely for compatibility with the mlr3 ecosystem, as this learner is used as a fallback for other survival learners that require an importance() method.

Usage

LearnerCompRisksAalenJohansen$importance()

Returns

Named numeric().


Method selected_features()

Selected features are always the empty set for this learner. This method is implemented only for compatibility with the mlr3 API, as this learner does not perform feature selection.

Usage

LearnerCompRisksAalenJohansen$selected_features()

Returns

character(0).


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerCompRisksAalenJohansen$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner (Aalen-Johansen/AJ estimator)
learner = lrn("cmprsk.aalen")
learner
#> 
#> ── <LearnerCompRisksAalenJohansen> (cmprsk.aalen): Aalen-Johansen Estimator ────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3cmprsk, and survival
#> • Predict Types: [cif]
#> • Feature Types: logical, integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: importance, missings, selected_features, and weights
#> • Other settings: use_weights = 'use', predict_raw = 'FALSE'

# Define a Task
task = tsk("pbc")

# Stratification based on event
task$set_col_roles(cols = "status", add_to = "stratum")

# Create train and test set
part = partition(task)

# Train the learner on the training set
learner$train(task, row_ids = part$train)
learner$native_model
#> Call: survfit(formula = task$formula(1), data = task$data(cols = task$target_names), 
#>     weights = NULL)
#> 
#>        n nevent     rmean se(rmean)*
#> (s0) 184      0 90.486196   4.278051
#> 1    184     12  7.761797   2.158935
#> 2    184     74 49.752008   4.282081
#>    *restricted mean time in state (max time = 148 )

# Make predictions for the test set
predictions = learner$predict(task, row_ids = part$test)
predictions
#> 
#> ── <PredictionCompRisks> for 92 observations: ──────────────────────────────────
#>  row_ids time event       CIF
#>        4   63     2 <list[2]>
#>        7   81     2 <list[2]>
#>        8   78     2 <list[2]>
#>      ---  ---   ---       ---
#>      139   81     1 <list[2]>
#>      256   29     1 <list[2]>
#>      262   17     1 <list[2]>

# Score the predictions
# AJ has random discriminative performance
predictions$score(msr("cmprsk.auc", time = 100))
#> cmprsk.auc 
#>        0.5 

# Prediction error (Brier score) at specific time point
# BS(t) => weighted mean score across causes (default)
predictions$score(msr("cmprsk.brier", time = 100))
#> cmprsk.brier 
#>    0.2248736