predict.cureit: Predicted survival probability by cure model

View source: R/base_methods.R

predict.cureitR Documentation

Predicted survival probability by cure model

Description

Predicted survival probability by cure model

Usage

## S3 method for class 'cureit'
predict(
  object,
  times = NULL,
  probs = NULL,
  newdata = NULL,
  method = "prob",
  brier = FALSE,
  cox = FALSE,
  ...
)

Arguments

object

A cureit object.

times

Numeric vector of times to obtain survival probability estimates at

probs

Numeric vector of quantiles to obtain estimates at

newdata

A base::data.frame() or tibble::tibble() containing all the original predictors used to create object. Defaults to NULL.

method

Output format of predicted values: "lp" (linear predictor) or "prob" (predicted probabilities).

brier

Boolean indicator of calculating the Brier scores at specified times.

cox

Boolean indicator of fitting the Cox model for the training data and calculating the Brier scores at specified times for newdata.

...

passed to methods

Value

named list of prediction estimates

See Also

Other cureit() functions: Brier_inference_bootstrap(), broom_methods_cureit, cureit(), nomogram()

Examples

p <- cureit(surv_formula = Surv(ttdeath, death) ~ age, 
   cure_formula = ~ age,
   data = trial) 
   
pred <- predict(p, times = seq(5,24,0.5),
 newdata = trial[complete.cases(trial), ], brier=TRUE,cox=TRUE)

plot(seq(5,24,0.5),pred$brier,type="S",pch=1)
lines(seq(5,24,0.5),pred$brier_cox,type="S",col="red",pch=3)
legend("topright",c("Cure model","Cox model"),
col=c("black","red"),lty=1,pch=c(1,3))

  

karissawhiting/cure-pipeline documentation built on Aug. 18, 2024, 1:22 a.m.