0

I have fitted a coxph model with time dependent variable of weight and time independent variables as following:

id start stop death weight age smoke
1   0     1    0     60     60   0
2   0     1    0     55     57   1 
2   1     2    1     60     58   1
...

mod <- coxph(Surv(start, stop, death) ~ weight + age + factor(smoke) + cluster(id), 
             data=data)

I want to plot the effect of weight on survival curve, the plot could have 2 survival curves, one for weight 60, the other for weight 80, which indicates the effect of increasing weight on the curve.

How do I make this plot?

Community
  • 1
  • 1
  • In medical studies, you would find that a decrease in weight of 20 kg in a smoker would be highly predictive of imminent death. I'm not sure it would make sense to calculate a value for a fixed weight when some of the time at risk might have come from persons with decreasing weight. – IRTFM Sep 20 '18 at 04:23
  • With time-dependent covariates, there is no fixed future survival/mortality experience unless the variables of interest remain fixed. You *can* plot survival provided the values are fixed, but for a given person with changing risk, you can only plot a series of changes in risk, not a survival curve per se. Also note that age as a time-dependent variable is somewhat redundant as age must increase as patients are followed forward in time. Starting age may be a more reasonable variable. – Todd D Sep 20 '18 at 18:48
  • @Todd D Do you mean I should plot survival curve 1 for people with weight 60( fixed smoke status is 1, starting age is 60), and then plot curve 2 for people with weight 80(fixed smoke status is 1, starting age is 60)? – Joey Zhou Sep 21 '18 at 04:39

1 Answers1

1

You can specify a data.frame with weight values at different time points, and based on this dataset you can calculate survival probabilities using the survfit() function of the survival package for your fitted Cox model but by also appropriately specifying the id argument.

However, note that weight is potentially and endogenous time-varying covariate for which the time-dependent Cox model is not theoretically appropriate. You could instead use a joint model for the longitudinal weight outcome and the time to event. These models are, for instance, implemented in the R packages JM and JMbayes. From a fitted joint model you can also obtain (dynamic) survival probabilities.

  • Because you are using R and not some other software, I suggest adding the "R" tag to this question. – James Phillips Sep 19 '18 at 12:45
  • Thanks for your answer,@Dimitris Rizopoulos, how to specifying the id argument? and for weight, it is endogenous so that you suggest joint model, but if the variable is temperature, is it ok to use coxph model? – Joey Zhou Sep 21 '18 at 04:54
  • Indeed temperature would be an exogenous time-varying covariate for which the Cox model is appropriate. With regard to the `id` argument, this needs to be the variable in the new dataset you provide that identifies which rows of the dataset belong to the same subject. Note that by doing that you obtain marginal survival probabilities, whereas from the joint model mentioned above you obtain conditional survival probabilities given that the subject was event-free up to a specific time-point. – Dimitris Rizopoulos Sep 21 '18 at 07:25
  • Do you mean the code survfit(mod, newdata=data.frame(weight=40)) should add cluster(id) in the new dataset fitted? – Joey Zhou Sep 21 '18 at 12:57