Forest-plot generic

Description

S3 generic for forest-style plots at a user-chosen reference time. survatr ships forrest.survatr_result() which slices the result at a single t_ref and renders one row per pairwise contrast with a point estimate and CI.

The deliberate misspelling forrest matches causatr’s convention (clarity about the plot style, not the Gump reference).

Usage

forrest(x, ...)

Arguments

x Object to dispatch on.
Arguments passed to methods.

Value

Method-dependent.

See Also

Other survatr_result methods: contrast(), contrast.survatr_fit(), forrest.survatr_result(), plot.survatr_result(), print.survatr_result(), tidy.survatr_result()

Examples

library("survatr")

set.seed(2)
n_id <- 40L
K <- 5L
pp <- data.frame(
  id = rep(seq_len(n_id), each = K),
  t = rep(seq_len(K), times = n_id),
  A = rep(rbinom(n_id, 1L, 0.5), each = K),
  Y = rbinom(n_id * K, 1L, 0.1)
)
fit <- surv_fit(pp, "Y", "A", ~1, "id", "t", time_formula = ~ factor(t))
res <- contrast(
  fit,
  interventions = list(a1 = causatr::static(1), a0 = causatr::static(0)),
  times = 1:5,
  type = "risk_difference"
)
forrest(res, t_ref = 5)