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)
prepare_longdata(df, t.from.base, subj.id, survtime, verbose = TRUE)
dataframe with the longitudinal measurements
name (as character) of the variable containing
time from baseline in df
name of the subject id variable in df
vector containing the survival time or censoring time
if TRUE
, a summary of the data manipulation
is printed
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
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