find_LOCF_risk_set: Find the risk set for a landmark model (LOCF)

View source: R/fit_LOCF_landmark.R

find_LOCF_risk_setR Documentation

Find the risk set for a landmark model (LOCF)

Description

This function is a helper function for fit_LOCF_landmark.

Usage

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).

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.

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.

Author(s)

Isobel Barrott isobel.barrott@gmail.com


isobelbarrott/Landmarking documentation built on Nov. 22, 2022, 4:50 a.m.