Elementary survival records from subjects and covariate changes
Source:R/survival.R
survival_split.RdBuilds the (entry, stop] pieces that model_survival(entry =, subject =) reads from
two tables: one row per subject with the end of its follow-up, the event indicator and
the covariates at the start, and one row per CHANGE of a time-dependent covariate, with
the time it happens and the new values. Each subject is cut at its change times; every
piece carries the covariate values in force during it, the subject's time-fixed columns,
and the event only on the last piece (a piece that ends before the end of the follow-up
is right-censored by construction). Changes at or after the end of the follow-up change
nothing and are dropped, with the count in the attribute "dropped_changes".
Arguments
- subjects
data.frame, one row per subject:
id,time(end of follow-up),event(1 failure, 0 censored), the starting values of every time-dependent covariate named inchanges, and any time-fixed column.eventfollows the rule ofcensor=inmodel_survival(): a factor or text event is read by its labels ("0" and "1", or "TRUE" and "FALSE"), never by the codes 1, 2, ... of the factor, and any other label is refused; the output carries it as the number 0 or 1.timeis numeric: a factor or text time is refused, naming the column- changes
data.frame:
id,at(the time of the change,> 0, numeric liketime) and the new values of one or more time-dependent covariates (columns also present insubjects)- id, time, event, at
column names