I want to perform a survival analysis which includes time-varying covariates, using the aalen() function from an R package called timereg. I think I have some idea about how the data should be represented in a dataframe (a tabular data structure in R), but I am not sure yet. So I thought I'd demonstrate what I have in mind right now and hope someone can tell if it's correct; any further discussions will be welcomed.

Here's what I think should be the general form for survival data that includes time-varying covariates:

  1. Each column represents a variable.
  2. Each row represents a follow up of a study subject at a specific time.
  3. There should be at least two variables that represent the outcome of each follow up: an interval of time from the beginning of the study to the point where the follow up was conducted, and an indicator that tells whether that specific follow up ended up being censored (indicator = 0) or actually observed an interested event (indicator = 1). Currently I am referring to them as "survival time" and "outcome indicator", respectively.
  4. A study subject may be followed up for several times and thus occupies multiple rows; these records are associated by a subject identifier (a subject id), and are ordered by the time variable mentioned earlier.
  5. For survival time, outcome indicator and time-varying covariates, the value may vary among rows, even if they belong to the same subject; for other variables (subject identifier and other covariates), the value should remain constant among different rows that belong to the same subject.

According to the rules above, I made up the following data set (sorry for the poor layout):

subject_id survival_time weight height outcome_indicator
1                               3           65      1.8      0
1                               4           68      1.8      0
1                               7           70      1.8      1
2                               2           55      1.6      0
2                               9           53      1.6      0
3                               2           62      1.7      0
3                               3           65      1.7      0
3                               5           64      1.7      0
3                               6           66      1.7      0

The variables subject_id, survival_time and outcome_indicator are explained earlier; in this case, weight is a time-varying covariate and height is a covariate that is independent of time. Some additional interpretations for the data set:

  1. There are 3 study subjects, identified by the subject_id variable, and they were followed up for 3, 2, 4 times, respectively.
  2. The weight of each subject changed at each follow up.
  3. The height of each subject remained the same at each follow up.
  4. Suppose the unit of survival_time is in years, then the interested event happened to subject 1 at year 7.
  5. Also suppose the study only intended to last for 9 years, then the event never happened to subject 2 during the life time of the study. Since subject 3 did not suffer the event at the last follow up, and that follow up was conducted years before the end of the study, it may suggest that subject 3 has dropped out due to other reasons. To sum up, both subject 2 and 3 are right censored cases.
  6. Each follow up that belongs to the same subject can be ordered by survival_time; the intervals are preferably constant among different subjects, but is not required.

Finally, here's a list of my questions (please don't hesitate to leave a comment even if you don't have all the answers, or if there doesn't seem to be any problems with the above descriptions):

  1. Am I right about the representation of survival data that includes time-varying covariates?
  2. If the answer to the first question is "no", then can you please point out what the problems are and provide some explanations?

For those who knows how to perform survival analysis in R, I would also like to ask that, based on the example data set (assuming it's in the right form) how do I specify the model formula and fit the aalen model (or any other model that includes time-varying covariates)? Is it something like:

aalen(formula = Survf(survival_time, outcome_indicator) ~ const(height) + weight, data = data_set, id = data_set$subject_id)

where the Survf() function is used to combine the two outcome-related variables; const() is used to denote time-varying covariates, leaving other covariates as they are; data_set is the name of the dataframe; and the id parameter is used to associate different rows of the same subject?

Many thanks in advance!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.