rmst: The restricted mean survival time (RMST)

View source: R/rmst.R

rmstR Documentation

The restricted mean survival time (RMST)

Description

Calculate the restricted mean survival time (RMST) for Surv object, Cox proportional model and other survival objects.

Usage

rmst(object, ...)
## Default S3 method:
rmst(object, ...)
## S3 method for class 'coxph'
rmst(object, newdata = NULL, linear.predictors = NULL, tau=NULL, ...)
## S3 method for class 'Surv'
rmst(object, tau = NULL, ...)

Arguments

object

for rmst.Surv and rmst.default, it is a survival object created by Surv(time, event). For others, it is a model object returned by coxph, lple.

linear.predictors

the linear predictor from the Cox PH model.

newdata

optional new data at which the RMST is calculated. If absent, RMST is for the dataframe used in the original model fit.

tau

the time point at which the Brier score is calculated.

...

additional arguments to be passed to the functions such as rmst.coxph, rmst.lple, rmst.Surv etc.

Details

The restricted mean survival time (RMST) is the mean of the truncated survival time at some finite value tau. The RMST is defined as,

RMST(tau) = E(min(T, tau)) = int_0 ^tau S(t)dt,

where S(t) = P(T>t) is the survival function of the random variable T.

Value

A value of the Brier score or integration of the Brier score is returned.

Author(s)

Bingshu E. Chen

See Also

coxph, Surv

Examples

  set.seed(29)
  n     = 25
  time  = rexp(n, 1)
  event = rbinom(n, 1, 0.75)
  x     = rnorm(n)
  y     = Surv(time, event)

  ### calculate the restricted mean survival time at tau = 0.5
  rms   = rmst(y, tau = 0.5)

  ### calculate the integrated brier score
  #fit   = coxph(y~x)
  #RMST  = rmst(fit, tau = 2)

statapps/lpl documentation built on June 1, 2025, 6:58 p.m.