View source: R/prepare_longdata.R
prepare_longdata | R Documentation |
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)
df |
dataframe with the longitudinal measurements |
t.from.base |
name (as character) of the variable containing
time from baseline in |
subj.id |
name of the subject id variable in |
survtime |
vector containing the survival time or censoring time |
verbose |
if |
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
Mirko Signorelli
Signorelli, M. (2024). pencal: an R Package for the Dynamic Prediction of Survival with Many Longitudinal Predictors. To appear in: The R Journal. Preprint: arXiv:2309.15600
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.