Interval-censored (IC) data record the event time of subject \(i\) only up to an interval \((L_i, R_i]\). pammtools handles such data via multiple imputation (MI): exact event times are repeatedly drawn from the model-based conditional distribution and the resulting (exact) data sets are transformed and re-fit using the standard right-censored PAMM pipeline (see pamm_ic). The functions documented here implement the preprocessing building blocks of that workflow.

detect_ic(formula, data)

parse_ic_surv(formula, data, id = "id")

resolve_ic_cut(ic, cut = NULL, max_time = NULL)

ic_event_data(ic, t_imp)

drop_zero_followup(evd, warn = TRUE)

as_ped_ic(data, formula, cut = NULL, max_time = NULL, id = "id", ...)

Arguments

formula

A two-sided formula whose left-hand side is an interval- censored Surv object.

data

A data frame containing the variables referenced in formula.

id

Name of the subject identifier column. If it does not exist in data it is created as a row index.

ic

A data frame as returned by parse_ic_surv.

cut

Optional numeric vector of interval cut-points. If NULL (default) the finite interval endpoints are used.

max_time

Optional numeric scalar; cut-points are capped at this value.

t_imp

Numeric vector of imputed event times (length nrow(ic)). Ignored for exact and right-censored rows.

evd

A data frame with a .ped_time column (output of ic_event_data).

warn

Logical; emit a one-time warning when rows are dropped.

...

Further arguments passed to the data.frame method and eventually to survSplit.

Details

IC data are specified through the standard survival interface, i.e. a three-argument response of the form Surv(L, R, type = "interval2"). The four observation types are encoded as usual:

exact

\(L = R\) (known event time).

right-censored

\(R = \infty\) (event after \(L\)).

left-censored

\(L = 0\) (event in \((0, R]\)).

interval-censored

\(0 < L < R < \infty\) (event in \((L, R]\)).

Functions

  • detect_ic(): Detect whether formula specifies interval-censored data. Returns "interval2" for interval-censored responses and "none" otherwise (right-censored and left-truncated counting-process responses both return "none" and are handled by the standard pipeline).

  • parse_ic_surv(): Parse the interval-censored response into a tibble of lower/upper bounds and observation type, augmenting data with the columns ic_L, ic_R and ic_kind (a factor with levels exact, right, left, interval) and, if absent, an id column.

  • resolve_ic_cut(): Resolve a fixed vector of interval cut-points for the IC transformation. When cut is supplied it is sorted and de-duplicated; otherwise the unique finite interval endpoints (the inspection times) are used, capped at max_time. The resolved cut must be shared across all imputations so that the PED interval structure is consistent across refits. Note that mgcv's centering constraints can still make the lpmatrix differ by fit.

  • ic_event_data(): Build the subject-level data frame of (exact) event times implied by an imputation. Exact observations keep their event time; right-censored observations are censored at ic_L; left- and interval-censored observations take the imputed time t_imp. Returns a data frame with the response columns .ped_time and .ped_status ready for split_data via a two-argument Surv.

  • drop_zero_followup(): Drop subjects with non-positive follow-up time (e.g.\ right-censored at time 0 with no observed inspection), which carry no information and would break the interval split. Returns the filtered data.

  • as_ped_ic(): Transform interval-censored data into an initial (midpoint-imputed) PED object. Left- and interval-censored event times are initialised at the interval midpoint (\((L+R)/2\), and \(R/2\) for left-censored observations); this object is only an initialiser for pamm_ic and should not be used for inference on its own. The parsed interval bounds and the resolved cut-points are attached as the "ic" and "breaks" attributes.