Learn R Programming

pencal (version 1.0.2)

prepare_longdata: Prepare longitudinal data for PRC

Description

This function removes from a longitudinal dataframe all measurements taken after the occurence of the event or after censoring. It is used internally by fit_lmms and it assumes that df is sorted by subj.id, with survival times given in the same order by subject id (fit_lmms automatically performs this sorting when needed)

Usage

prepare_longdata(df, t.from.base, subj.id, survtime, verbose = TRUE)

Arguments

df

dataframe with the longitudinal measurements

t.from.base

name (as character) of the variable containing time from baseline in df

subj.id

name of the subject id variable in df

survtime

vector containing the survival time or censoring time

verbose

if TRUE, a summary of the data manipulation is printed

Value

A list containing: a reduced dataframe called df.sanitized, where only measurements taken before t are retained; the number of measurements retained (n.kept) and removed (n.removed) from the input data frame

References

Signorelli, M., Spitali, P., Al-Khalili Szigyarto, C, The MARK-MD Consortium, Tsonaka, R. (2021). Penalized regression calibration: a method for the prediction of survival outcomes using complex longitudinal and high-dimensional data. Statistics in Medicine, 40 (27), 6178-6196. DOI: 10.1002/sim.9178