Skip to contents

Backend-aware predictions over a time grid for one or more covariate profiles. Parametric, spline and cure fits use the backend's own distribution function and support every type. Cox and Kaplan-Meier fits use survival::survfit() and support "survival" and "cumhaz". Frailty, interval-censored, competing-risk and recurrent-event fits have no survival curve and are refused.

Usage

sest_curve(
  fit,
  newdata = NULL,
  times = NULL,
  type = c("survival", "hazard", "cumhaz", "quantile")
)

Arguments

fit

A sest_fit of kind "parametric", "spline", "cure", "cox" or "nonparametric".

newdata

A data frame of covariate profiles. The default is the profile at the means of the covariates: a numeric 1/2 arm is set to 1.5, and a factor enters through the means of its indicator columns (flexsurv gives one curve per combination when every covariate is a factor). Give newdata for a profile that exists.

times

Numeric times at which to evaluate. The default is an automatic grid from the backend.

type

Character quantity to predict: "survival" (default), "hazard", "cumhaz" or "quantile". "hazard" and "quantile" need a parametric, spline or cure fit.

Value

A data frame with time (or quantile), value and profile, the row of newdata the curve is for. For a fit with groups (a Kaplan-Meier fit by a variable, or a stratified Cox fit) a group column gives each curve's group, and a Kaplan-Meier profile numbers the groups.

See also

sest_tidy() for the coefficient table, sest_rmst() for the restricted mean.

Other fit-methods: sest_tidy()

Examples

fit <- survestimand(survival::Surv(time, status) ~ age, survival::lung, method = "weibull")
head(sest_curve(fit, times = c(100, 300, 500)))
#>   time     value profile
#> 1  100 0.8594618       1
#> 2  300 0.5250282       1
#> 3  500 0.2827438       1