Skip to contents

A lightweight response constructor used in cifcurve() and polyreg() to pass survival and competing-risks data via a model formula.

Usage

Event(time, event, allowed = getOption("cifmodeling.allowed", c(0, 1, 2)))

Arguments

time

Numeric vector of follow-up times (non-negative).

event

Integer (0=censor, 1,2,...) or a character/factor vector whose levels are numeric codes "0","1","2",... for competing events.

allowed

Numeric vector of acceptable event codes.

Value

An object of class "Event" (a 2-column matrix) with columns time, event.

Lifecycle

[Stable]

See also

polyreg() for log-odds product modeling of CIFs; cifcurve() for KM/AJ estimators; cifplot() for display of a CIF; cifpanel() for display of multiple CIFs; ggsurvfit::ggsurvfit, patchwork::patchwork and modelsummary::modelsummary for display helpers.

Examples

## event: 0=censor, 1=primary, 2=competing
data(diabetes.complications)
output <- polyreg(
  nuisance.model = Event(t, epsilon) ~ +1,
  exposure = "fruitq1",
  data = diabetes.complications,
  effect.measure1 = "RR",
  effect.measure2 = "RR",
  time.point = 8,
  outcome.type = "competing-risk"
)