Skip to contents

Cox proportional hazards model fitted via generalized additive modeling. Internally calls mgcv::gam() from the mgcv package with family = mgcv::cox.ph(). The censoring indicator is passed via the weights argument.

Prediction types

Three types of prediction are returned for this learner:

  1. lp: a vector of linear predictors (relative risk scores), one per observation. Calls mgcv::predict.gam() with type = "link".

  2. crank: same as lp.

  3. distr: a survival matrix in two dimensions, where observations are represented in rows and time points in columns. By default, the Breslow estimator is used via mlr3proba::breslow().

Dictionary

This Learner can be instantiated via lrn():

lrn("surv.gam.cox")

Meta Information

  • Task type: “surv”

  • Predict Types: “crank”, “distr”, “lp”

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

  • Required Packages: mlr3, mlr3proba, mlr3extralearners, mgcv

Parameters

IdTypeDefaultLevelsRange
formulauntyped--
methodcharacterGCV.CpGCV.Cp, GACV.Cp, REML, P-REML, ML, P-ML-
optimizeruntypedc("outer", "newton")-
scalenumeric0\((-\infty, \infty)\)
selectlogicalFALSETRUE, FALSE-
knotsuntypedNULL-
spuntypedNULL-
min.spuntypedNULL-
HuntypedNULL-
gammanumeric1\([1, \infty)\)
paraPenuntypedNULL-
GuntypedNULL-
in.outuntypedNULL-
drop.unused.levelslogicalTRUETRUE, FALSE-
drop.interceptlogicalFALSETRUE, FALSE-
neiuntyped--
nthreadsinteger1\([1, \infty)\)
ncv.threadsinteger1\([1, \infty)\)
irls.regnumeric0\([0, \infty)\)
epsilonnumeric1e-07\([0, \infty)\)
maxitinteger200\((-\infty, \infty)\)
mgcv.tolnumeric1e-07\([0, \infty)\)
mgcv.halfinteger15\([0, \infty)\)
tracelogicalFALSETRUE, FALSE-
rank.tolnumeric1.490116e-08\([0, \infty)\)
nlmuntypedlist()-
optimuntypedlist()-
newtonuntypedlist()-
idLinksBaseslogicalTRUETRUE, FALSE-
scalePenaltylogicalTRUETRUE, FALSE-
efs.lspmaxinteger15\([0, \infty)\)
efs.tolnumeric0.1\([0, \infty)\)
scale.estcharacterfletcherfletcher, pearson, deviance-
edge.correctlogicalFALSETRUE, FALSE-
block.sizeinteger1000\((-\infty, \infty)\)
unconditionallogicalFALSETRUE, FALSE-

Formula

A gam formula specific to the task at hand is required for the formula parameter (see example and ?mgcv::formula.gam). Beware, if no formula is provided, a fallback formula is used that will make the gam behave like a glm (this behavior is required for the unit tests). Only features specified in the formula will be used, superseding columns with col_roles "feature" in the task.

Offset

If a Task contains a column with the offset role, it is automatically incorporated during training via the offset argument in mgcv::gam(). No offset is applied during prediction for this learner.

References

Wood, Simon (2012). “mgcv: Mixed GAM Computation Vehicle with GCV/AIC/REML smoothness estimation.”

Wood, N. S, Pya, Natalya, Safken, Benjamin (2016). “Smoothing Parameter and Model Selection for General Smooth Models.” Journal of the American Statistical Association, 111(516), 1548–1563. doi:10.1080/01621459.2016.1180986 .

Author

bblodfon

Super classes

mlr3::Learner -> mlr3proba::LearnerSurv -> LearnerSurvGamCox

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerSurvGamCox$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# simple example
t = tsk("lung")
l = lrn("surv.gam.cox")
l$param_set$set_values(formula = time ~ s(age, k = 5) + ph.karno + sex)
l$train(t)
l$model
#> 
#> Family: Cox PH 
#> Link function: identity 
#> 
#> Formula:
#> time ~ s(age, k = 5) + ph.karno + sex
#> 
#> Estimated degrees of freedom:
#> 1  total = 3 
#> 
#> REML score: 513.9053