Skip to contents

Fine-Gray subdistribution hazards model for competing risks using cmprsk::crr().

Details

A separate Fine-Gray subdistribution hazards model is fitted for every cause in task$causes. This follows the LearnerCompRisks design: predictions contain CIFs for all available causes.

The fitted model is an S3 object of class "fine_gray" that stores a list of cause-specific crr class models, with NULL entries for causes without training events.

At prediction time, each cause-specific model is evaluated with cmprsk::predict.crr(), retaining its native cause-specific event-time grid. Each grid contains the unique training event times for that cause and is stored in the prediction's $times field. Causes without training events have a zero CIF anchored at time 0.

Independently fitted cause-specific models can produce CIFs whose sum exceeds 1. The corresponding warning is disabled package-wide by default, as it can recur on every prediction call. Set options(mlr3cmprsk.warn_cif_sum = TRUE) to enable it. See also Package Options section in mlr3cmprsk-package.

Time-interaction terms (via cov2) are not implemented.

Dictionary

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

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

Meta Information

  • Task type: “cmprsk”

  • Predict Types: “cif”

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

  • Required Packages: mlr3, mlr3cmprsk, cmprsk

Parameters

IdTypeDefaultLevelsRange
cengroupuntyped--
gtolnumeric1e-06\([0, \infty)\)
maxiterinteger10\([0, \infty)\)
inituntyped--
variancelogicalTRUETRUE, FALSE-

References

Fine, P J, Gray, J R (1999). “A Proportional Hazards Model for the Subdistribution of a Competing Risk.” Journal of the American Statistical Association, 94(446), 496–509. doi:10.1080/01621459.1999.10474144 .

See also

Other competing risk learners: mlr_learners_cmprsk.aalen

Super classes

mlr3::Learner -> LearnerCompRisks -> LearnerCompRisksFineGray

Methods

Inherited methods


LearnerCompRisksFineGray$new()

Creates a new instance of this R6 class.


LearnerCompRisksFineGray$clone()

The objects of this class are cloneable with this method.

Usage

LearnerCompRisksFineGray$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define a task
task = tsk("pbc")
task$select(c("age", "chol", "albumin", "ast", "bili", "protime"))

# Stratify by event status
task$set_col_roles(cols = "status", add_to = "stratum")
task
#> 
#> ── <TaskCompRisks> (276x8): Mayo Clinic Primary Biliary Cholangitis Data ───────
#> • Target: time and status
#> • Properties: strata
#> • Features (6):
#>   • dbl (4): albumin, ast, bili, protime
#>   • int (2): age, chol
#> • Strata: status
#> • Causes (2):
#>   • 1 (Liver transplantation): 18 (6.5%)
#>   • 2 (Death without transplantation): 111 (40.2%)
#> • Censored: 147 (53.3%)

# Create training and test sets
set.seed(42L)
part = partition(task)

# Define the learner
learner = lrn("cmprsk.fg")

# Train on the training set
learner$train(task, row_ids = part$train)
learner$native_model
#> $`1`
#> convergence:  TRUE 
#> coefficients:
#>        age    albumin        ast       bili       chol    protime 
#> -0.0980000 -0.4300000 -0.0020780 -0.0006369  0.0009530 -0.2304000 
#> standard errors:
#> [1] 0.028100 0.954300 0.003896 0.078480 0.001298 0.398700
#> two-sided p-values:
#>     age albumin     ast    bili    chol protime 
#> 0.00049 0.65000 0.59000 0.99000 0.46000 0.56000 
#> 
#> $`2`
#> convergence:  TRUE 
#> coefficients:
#>        age    albumin        ast       bili       chol    protime 
#>  4.616e-02 -1.043e+00  3.302e-03  1.210e-01  2.155e-05  2.181e-01 
#> standard errors:
#> [1] 0.0134800 0.2482000 0.0019800 0.0175100 0.0004066 0.1088000
#> two-sided p-values:
#>     age albumin     ast    bili    chol protime 
#> 6.2e-04 2.6e-05 9.5e-02 4.9e-12 9.6e-01 4.5e-02 
#> 
#> attr(,"class")
#> [1] "fine_gray"

# Predict CIFs for the test set
predictions = learner$predict(task, row_ids = part$test)
predictions
#> 
#> ── <PredictionCompRisks> for 92 observations: ──────────────────────────────────
#>  row_ids time event       CIF
#>        1  400     2 <list[2]>
#>       10 3762     2 <list[2]>
#>       16  131     2 <list[2]>
#>      ---  ---   ---       ---
#>      157 2241     1 <list[2]>
#>      208  837     1 <list[2]>
#>      213 1435     1 <list[2]>

# Score predictions
predictions$score()
#> cmprsk.ibs 
#>  0.1107625