calc.Crude.quantile: Compute the time to statistical cure using the conditional...

View source: R/calc.Crude.quantile.R

calc.Crude.quantileR Documentation

Compute the time to statistical cure using the conditional probability of disease-related death

Description

The following function estimates the time to statistical cure using the conditional probability of disease-related death.

Usage

calc.Crude.quantile(
  fit,
  q = 0.05,
  newdata = NULL,
  max.time = 20,
  exp.fun = NULL,
  var.type = c("ci", "se", "n"),
  rmap,
  ratetable = cuRe::survexp.dk,
  tau = 100,
  reverse = TRUE,
  scale = ayear
)

Arguments

fit

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

q

Threshold to estimate statistical cure according to.

newdata

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

max.time

Upper boundary of the interval [0, max.time] in which to search for solution (see details). Default is 20.

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.

var.type

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

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.

ratetable

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

tau

Upper bound of integral (see ?calc.Crude). Default is 100.

reverse

Logical passed on to calc.Crude. If TRUE (default), 1 - probability is provided. Only applicable for type = condother.

scale

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

Details

The cure point is calculated as the time point at which the conditional probability of disease-related death reaches the threshold, q. If q is not reached within max.time, no solution is reported.

Value

The estimated cure point.

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), 500), ]

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

#Fit cure model and estimate cure point
fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6,
                     bhazard = colonDC$bhaz, cure = TRUE)
cp <- calc.Crude.quantile(fit, q = 0.05,
                          rmap = list(age = agedays, sex = sex, year = dx))

#Compare the result with the trajectory of the conditional probability of disease-related death
res <- calc.Crude(fit, type = "condother", time = seq(0, 20, length.out = 100),
                  var.type = "n",
                  rmap = list(age = agedays, sex = sex, year = dx), reverse = TRUE)
plot(res)
abline(h = 0.05, v = cp$Estimate)


LasseHjort/cuRe documentation built on July 6, 2023, 1:08 p.m.