riskset: Compute the risk set indicator

View source: R/helperfuns.R

risksetR Documentation

Compute the risk set indicator

Description

Identify set of individuals at risk of experiencing the event before event time (failure time), t_i. The risk set, R_i, is the set of individuals, j, who had not experienced the event or had been censored by time t_i. This function identifies this set and computes event times satisfying this.

Usage

riskset(
  formula,
  data,
  contrasts.arg = NULL,
  xlevs = NULL,
  scaleX = TRUE,
  na.action = na.omit
)

Arguments

formula

Object of class formula describing the model. The response and terms are specified similar to Surv function.

data

optional data frame containing variables specified in the formula.

contrasts.arg

an optional list. See the contrasts.arg of [stats]{model.matrix.default}.

xlevs

a named list of character vectors giving the full set of levels to be assumed for each factor. See [stats]{model.frame}.

scaleX

logical. If TRUE (default), predictors are scaled/standardized. This is used internally.

na.action

a function which indicates what should happen when the data contain NAs. See [stats]{model.frame}.

Details

Let t_1 < t_2 <, ..., t_m, such that m < n if there are not ties, otherwise m = n. If covariates are time-independent the risk set, R_i, is the set of individuals who are still at risk at time t_i, i.e., individuals with event/censoring time y_j≥ t_i. For time-dependent covariates risk set at time t_i is now defined as R(t_i) = \{j : (y^{stop}_{j} ≥ t_i) \wedge (y^{start}_{j} < t_i)\}. The first condition, (y^{stop}_{j} ≥ t_i), ensures that individual j either experienced the event or was censored at a later time point than t_i, while the second condition, (y^{start}_{j} < t_i), ensures the start time was observed before the event.

Value

A list of survival objects:

Y

Surv object defining the event times and event status.

X

model matrix of model terms.

events

observed events.

times

event times defined by risk set condition.

timevarlabel, eventvarlabel

time and event variables, respectively.

scale_sd, scale_mu

standard deviation and mean of each of the variable used in standardization.


pcoxtime documentation built on May 13, 2022, 1:05 a.m.

Related to riskset in pcoxtime...