Takes as input an individual-level dataset including data on both
progression and death time (jointly) and manipulates it using
dplyr functions to create a full "multi-state" dataset, in
which all the transitions are tracked. This can then be used
to fit survival models and compute all the estimates for the
whole set of transition probabilities
make_data_multi_state(
data,
id = "id",
prog = "prog",
death = "death",
prog_t = "prog_t",
death_t = "death_t",
keep = NULL,
...
)A tibble containing the event history for each individual and with the following variables: id = Patients ID; from = Initial state (1=Pre-progression, 2=Progression, 3=Death); to = End state (1=Pre-progression, 2=Progression, 3=Death); trans = Transition ID: 1=Pre-progression -> Progression; 2=Pre-Progression -> Death; 3=Progression -> Death; Tstart = Entry time (either entry or progression); Tstop = Exit time (time of event or censoring time); status = Event indicator (1=yes, 0=censored), for the specific event under consideration; treat = Treatment indicator All the other original variables are appended to these, but can be removed
dataset containing the full ILD with information on both progression and death. Can be a data.frame or a tibble
The column with the individual identifier. Can be NULL (in which case, it will be created from scratch)
The progression indicator: takes value 1 if the individual has progressed and 0 otherwise. Defaults to the column named 'prog' in the dataset
The death indicator: takes value 1 if the individual has died and 0 otherwise. Defaults to the column named 'death' in the dataset
The progression time. Defaults to the column named 'prog_t' in the dataset
The death time. Defaults to the column named 'death_t' in the dataset
A vector of strings with the names of the additional variables from the original dataset to keep into the multistate dataset. If 'NULL' (default), then keeps all
additional arguments.
Gianluca Baio
Something will go here
Something will go here
if (FALSE) {
# Something will go here
}
Run the code above in your browser using DataLab