lts: Long term survival predictions

View source: R/lts.R

ltsR Documentation

Long term survival predictions

Description

Function for computing survival estimates using a relative survival model and the expected general population survival.

Usage

lts(
  fit,
  type = c("surv", "hazard", "cumhaz", "loghaz", "fail"),
  newdata = NULL,
  time = NULL,
  var.type = c("ci", "se", "n"),
  exp.fun = NULL,
  ratetable = cuRe::survexp.dk,
  rmap,
  scale = 365.24,
  smooth.exp = FALSE,
  link = NULL,
  mean = FALSE
)

Arguments

fit

Fitted model to do predictions from. Possible classes are gfcm, stpm2, pstpm2, and cm.

type

Prediction type (see details). The default is surv.

newdata

Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on.

time

Optional time points at which to compute predictions. If empty, a grid of 100 time points between 0 and the maximum follow-up time is selected.

var.type

Character. Possible values are "ci" (default) for confidence intervals, "se" for standard errors, and "n" for neither.

exp.fun

Object of class list containing functions for the expected survival of each row in newdata. If not specified, the function computes the expected survival based on newdata using the survival::survexp function. If newdata is not provided, the expected survival is based on the data which the model was fitted on.

ratetable

Object of class ratetable used to compute the general population survival. Default is survexp.dk.

rmap

List to be passed to survexp from the survival package if exp.fun = NULL. Detailed documentation on this argument can be found by ?survexp.

scale

Numeric. Passed to the survival::survexp function and defaults to 365.24. That is, the time scale is assumed to be in years.

smooth.exp

Logical. If TRUE, the general population survival function is smoothed by the function smooth.spline using the the argument all.knots = TRUE.

link

Character, indicating the link function for the variance calculations. Possible values are "log", "cloglog" for log(-log(x)) , "mlog" for -log(x), and "I" for the indentity.

mean

Logical. If TRUE, the function outputs the average estimate across the rows in newdata. If newdata = NULL, the argument is not used. The default is FALSE.

Details

Possible values for argument type are:
surv: Survival function computed by S(t) = R(t)S^*(t)
hazard: Hazard function computed by h(t) = \lambda(t) + h^*(t)
cumhaz: The cumulative hazard function computed by H(t) = \Lambda(t) + H^*(t)
loghazard: The log-hazard function computed by \log(\lambda(t) + h^*(t))
fail: The distribution function computed by 1 - R(t)S^*(t)

Value

An object of class lts containing the predictions of each individual in newdata.

Examples

##Use data cleaned version of the colon cancer data from the rstpm2 package
data("colonDC")
set.seed(2)
colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ]

##Extract general population hazards
colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"),
                            data = colonDC, ratetable = survexp.dk)

##Fit flexible parametric relative survival model
fit <- stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz)

##Compute survival probabilities from 0 to 20 years
pred <- lts(fit, rmap = list(age = agedays, sex = sex, year = dx))

##Plot the survival function
plot(pred)

cuRe documentation built on July 9, 2023, 7 p.m.

Related to lts in cuRe...