| lts | R Documentation | 
Function for computing survival estimates using a relative survival model and the expected general population survival.
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
)
| fit | Fitted model to do predictions from. Possible classes are  | 
| type | Prediction type (see details). The default is  | 
| 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 " | 
| exp.fun | Object of class  | 
| ratetable | Object of class  | 
| rmap | List to be passed to  | 
| scale | Numeric. Passed to the  | 
| smooth.exp | Logical. If  | 
| link | Character, indicating the link function for the variance calculations.
Possible values are " | 
| mean | Logical. If  | 
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)
An object of class lts containing the predictions of each individual in newdata.
##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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.