R: Prediction Object for Survival

PredictionSurv {mlr3proba} | R Documentation

## Prediction Object for Survival

### Description

This object stores the predictions returned by a learner of class LearnerSurv.

The `task_type` is set to `"surv"`.

### Super class

`mlr3::Prediction` -> `PredictionSurv`

### Active bindings

`truth`

  (`Surv`)
  True (observed) outcome.

`crank`

  (`numeric()`)
  Access the stored predicted continuous ranking.

`distr`

  (VectorDistribution)
  Access the stored predicted survival distribution.

`lp`

  (`numeric()`)
  Access the stored predicted linear predictor.

`response`

  (`numeric()`)
  Access the stored predicted survival time.

### Methods

#### Public methods

- `PredictionSurv$new()`

- `PredictionSurv$clone()`

Inherited methods

- `mlr3::Prediction$format()`

- `mlr3::Prediction$help()`

- `mlr3::Prediction$print()`

- `mlr3::Prediction$score()`

#### Method `new()`

Creates a new instance of this R6 class.

##### Usage

    PredictionSurv$new(
      task = NULL,
      row_ids = task$row_ids,
      truth = task$truth(),
      crank = NULL,
      distr = NULL,
      lp = NULL,
      response = NULL,
      check = TRUE
    )

##### Arguments

`task`

  (TaskSurv)
  Task, used to extract defaults for `row_ids` and `truth`.

`row_ids`

  (`integer()`)
  Row ids of the predicted observations, i.e. the row ids of the test set.

`truth`

  (`survival::Surv()`)
  True (observed) response.

`crank`

  (`numeric()`)
  Numeric vector of predicted continuous rankings (or relative risks). One element for each observation in the test set. For a pair of continuous ranks, a higher rank indicates that the observation is more likely to experience the event.

`distr`

  (VectorDistribution)
  VectorDistribution from distr6. Each individual distribution in the vector represents the random variable 'survival time' for an individual observation.

`lp`

  (`numeric()`)
  Numeric vector of linear predictor scores. One element for each observation in the test set. lp = Xβ where X is a matrix of covariates and β is a vector of estimated coefficients.

`response`

  (`numeric()`)
  Numeric vector of predicted survival times. One element for each observation in the test set.

`check`

  (`logical(1)`)
  If `TRUE`, performs argument checks and predict type conversions.

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    PredictionSurv$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

### See Also

Other Prediction: `PredictionDens`

### Examples

    if (requireNamespace("rpart", quietly = TRUE)) {
    library(mlr3)
    task = tsk("rats")
    learner = mlr_learners$get("surv.rpart")
    p = learner$train(task, row_ids = 1:20)$predict(task, row_ids = 21:30)
    head(as.data.table(p))
    }

[Package mlr3proba version 0.3.2 Index]