Skip to contents

Processes interval-censored data (and corresponding indicators) to produce an ordered set of exam times and flags indicating censoring status. It also adjusts certain delta and gamma values based on constraints so that the first observation is always an event time, and the last observation is always right-censored.

Usage

order_rank(delta, gamma, U, V, Z)

Arguments

delta

Numeric (0/1). Event indicator for left endpoint U.

gamma

Numeric (0/1). Event indicator for right endpoint V.

U

Numeric vector of left endpoints of censoring intervals (may contain NA).

V

Numeric vector of right endpoints of censoring intervals (may contain NA).

Z

A matrix (or data frame) of covariates, with one row per subject.

Value

A list with the following components:

t

A condensed, ordered set of exam times.

index

A matrix of dimension n x 2, giving the ranks (indices) for U and V after ordering.

data

A matrix (or data frame) containing the updated delta, gamma, U, V, and Z values.

Details

This function ensures that the earliest recorded time in t corresponds to a left endpoint that is truly an event, while the latest recorded time is right-censored. It also removes observations that are no longer valid after these adjustments. The vector flag is used internally to mark observation types (1 = event, 2 = left-censored, 3 = both, 4 = right-censored).

Examples

# (Not run) Example usage (requires suitable data)
# delta <- c(1, 0, 0)
# gamma <- c(0, 1, 0)
# U <- c(2, 2, 3)
# V <- c(NA, 4, 5)
# Z <- matrix(rnorm(9), nrow = 3)
# order_rank(delta, gamma, U, V, Z)