This function is a helper function for fit_LOCF_landmark.

find_LOCF_risk_set(
  data_long,
  x_L,
  x_hor,
  covariates,
  covariates_time,
  individual_id,
  event_time,
  event_status
)

Arguments

data_long

Data frame in long format i.e. there may be more than one row per individual

x_L

Numeric specifying the landmark time(s)

x_hor

Numeric specifying the horizon time(s)

covariates

Vector of character strings specifying the column names in data_long which correspond to the covariates

covariates_time

Vector of character strings specifying the column names in data_long which contain the times at which covariates were recorded. This should either be length 1 or the same length as covariates. In the latter case the order of elements must correspond to the order of elements in covariates.

individual_id

Character string specifying the column name in data_long which contains the individual identifiers

event_time

Character string specifying the column name in data_long which contains the event time

event_status

Character string specifying the column name in data_long which contains the event status (where 0=censoring, 1=event of interest, if there are competing events these are labelled 2 or above).

Value

List with elements corresponding to each landmark time in x_L. Each element is a data frame, containing only those individuals in the risk set at each of the landmark times x_L.

Details

This function finds the risk set for each of landmark times in x_L. This means that each of the individuals has a LOCF value for all covariates at the landmark time and has not experienced an event up to (and including) the landmark time.

Author

Isobel Barrott isobel.barrott@gmail.com