mlr_learners_surv.parametric | R Documentation |
Parametric survival model.
Calls parametric()]
from 'survivalmodels'.
This learner allows you to choose a distribution and a model form to compose a predicted survival probability distribution.
The predict method is implemented in survivalmodels::predict.parametric()
.
Our implementation is more efficient for composition to distributions than
survival::predict.survreg()
.
Three types of prediction are returned for this learner:
lp
: a vector of linear predictors (relative risk scores), one per test
observation.
lp
is predicted using the formula lp = X\beta
where X
are the
variables in the test data set and \beta
are the fitted coefficients.
crank
: same as lp
.
distr
: a survival matrix in two dimensions, where observations are
represented in rows and time points in columns.
The distribution distr
is composed using the lp
predictions and specifying
a model form in the form
hyper-parameter. These are as follows, with respective
survival functions:
Accelerated Failure Time (aft
)
S(t) = S_0(\frac{t}{exp(lp)})
Proportional Hazards (ph
)
S(t) = S_0(t)^{exp(lp)}
Proportional Odds (po
)
S(t) =
\frac{S_0(t)}{exp(-lp) + (1-exp(-lp)) S_0(t)}
Tobit (tobit
)
S(t) = 1 - \Phi((t - lp)/s)
where S_0
is the estimated baseline survival distribution (in
this case with a given parametric form), lp
is the predicted linear
predictor, \Phi
is the cdf of a N(0, 1) distribution, and s
is
the fitted scale parameter.
Whilst any combination of distribution and model form is possible, this does not mean it will necessarily create a sensible or interpretable prediction. The following combinations are 'sensible' (we note that ones mostly used in the literature):
dist = "gaussian"; form = "tobit";
dist = "weibull"; form = "ph"; (fairly used)
dist = "exponential"; form = "ph";
dist = "weibull"; form = "aft"; (fairly used, default option)
dist = "exponential"; form = "aft";
dist = "loglogistic"; form = "aft"; (fairly used)
dist = "lognormal"; form = "aft";
dist = "loglogistic"; form = "po";
discrete
determines the class of the returned survival probability
distribution. If FALSE
(default) continuous probability
distributions are returned using distr6::VectorDistribution, otherwise
distr6::Matdist (faster to calculate survival measures that require a
distr
prediction type).
This Learner can be instantiated via lrn():
lrn("surv.parametric")
Task type: “surv”
Predict Types: “crank”, “distr”, “lp”
Feature Types: “logical”, “integer”, “numeric”, “factor”
Required Packages: mlr3, mlr3proba, mlr3extralearners, survival, pracma
Id | Type | Default | Levels | Range |
form | character | aft | aft, ph, po, tobit | - |
na.action | untyped | - | - | |
dist | character | weibull | weibull, exponential, gaussian, lognormal, loglogistic | - |
parms | untyped | - | - | |
init | untyped | - | - | |
scale | numeric | 0 | [0, \infty) |
|
maxiter | integer | 30 | (-\infty, \infty) |
|
rel.tolerance | numeric | 1e-09 | (-\infty, \infty) |
|
toler.chol | numeric | 1e-10 | (-\infty, \infty) |
|
debug | integer | 0 | [0, 1] |
|
outer.max | integer | 10 | (-\infty, \infty) |
|
robust | logical | FALSE | TRUE, FALSE | - |
score | logical | FALSE | TRUE, FALSE | - |
cluster | untyped | - | - | |
discrete | logical | - | TRUE, FALSE | - |
Package 'survivalmodels' is not on CRAN and has to be install from GitHub via
remotes::install_github("RaphaelS1/survivalmodels")
.
mlr3::Learner
-> mlr3proba::LearnerSurv
-> LearnerSurvParametric
new()
Creates a new instance of this R6 class.
returned risk
from survivalmodels is hp-style
ie higher value => higher risk
LearnerSurvParametric$new()
clone()
The objects of this class are cloneable with this method.
LearnerSurvParametric$clone(deep = FALSE)
deep
Whether to make a deep clone.
bblodfon
Kalbfleisch, D J, Prentice, L R (2011). The statistical analysis of failure time data. John Wiley & Sons.
Dictionary of Learners: mlr3::mlr_learners.
as.data.table(mlr_learners)
for a table of available Learners in the running session (depending on the loaded packages).
Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
# Define the Learner
learner = mlr3::lrn("surv.parametric")
print(learner)
# Define a Task
task = mlr3::tsk("grace")
# Create train and test set
ids = mlr3::partition(task)
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
print(learner$model)
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.