er_style_tte_model: Model-curve builders for the TTE grammar

er_style_tte_modelR Documentation

Model-curve builders for the TTE grammar

Description

Builder functions for the model layer (er_tte_add_model()), drawing a fitted parametric S(t) curve with an optional uncertainty band.

Usage

er_style_tte_model_line(
  data,
  config,
  stratify,
  time,
  strata,
  theme,
  show_ci = TRUE,
  ribbon_alpha = 0.15,
  linewidth = 1,
  ...
)

Arguments

data

The original data frame (object$data).

config

Configuration for the model layer (populated by er_tte_add_model()): config$predictions (the prediction tibble from er_predict_survival(), with time/fit_survival/ ci_lower/ci_upper columns), config$time_grid, config$conf_level.

stratify

Logical: whether the fit is stratified (!is.null(object$strata)).

time

object$time (name/label/limits).

strata

object$strata (var/label), or NULL when unstratified.

theme

object$theme.

show_ci

Whether to draw the confidence band. Default TRUE.

ribbon_alpha

Transparency of the confidence band (0-1). Default 0.15.

linewidth

Width of the curve's line. Default 1.

...

Additional named arguments forwarded from er_tte_add_model()'s own ....

Details

See er_style_tte() for the shared interface every TTE-grammar builder implements.

Unlike er_style_tte_curve_km()'s Kaplan-Meier step curve, config$predictions is a smooth prediction grid (one row per newdata row x config$time_grid value), so er_style_tte_model_line() draws an ordinary ggplot2::geom_line()/ggplot2::geom_ribbon() pair rather than a step function.

Stratified colour/fill both map to config$predictions's own strata column (named after strata$var) rather than a fixed name – unlike er_style_tte_curve_km(), which always reads a column literally named strata (the tidied Kaplan-Meier table's own naming). er_tte_build() still retitles the resulting legend with strata$label afterwards.

er_style_tte_model_line() is tagged er_style_tag(fn, layer = "tte_model") – distinct from er_plot_add_model()'s own "model" tag, since the two grammars' model builders share no signature or config contents – so er_tte_add_model() errors informatively if handed a builder tagged for a different layer (including er_plot_add_model()'s own builders).

Value

A geom, or a list of geoms.

See Also

er_tte_add_model(), er_style_tte_curve_km(), er_style_tte()


erplots documentation built on Oct. 4, 2026, 5:06 p.m.