Skip to main content
21 events
when toggle format what by license comment
Oct 7, 2018 at 22:18 vote accept ecjb
Oct 5, 2018 at 21:34 comment added EdM Let us continue this discussion in chat.
Oct 5, 2018 at 20:53 comment added ecjb thank you very much @EdM. After your comment, I added a loess fit to the last plot. What should be the best interpretation of the analysis? "using splines with 4 knots, the variable risk factor reasonably approached a constant 0 value of the residuals"
Oct 5, 2018 at 20:50 history edited ecjb CC BY-SA 4.0
added 359 characters in body
Oct 5, 2018 at 20:29 history edited ecjb CC BY-SA 4.0
added 6 characters in body
Oct 5, 2018 at 20:16 history edited ecjb CC BY-SA 4.0
added 20 characters in body
Oct 5, 2018 at 19:30 comment added EdM Add a loess fit to that last plot to show a reasonably flat relation and you're done. Consider putting together your work into an answer to your own question; that's OK on this site.
Oct 5, 2018 at 18:37 answer added Dimitris Rizopoulos timeline score: 3
Oct 5, 2018 at 18:23 comment added ecjb Ok @Edm. So i used 6! knots and plotted the residual against the the risk factors
Oct 5, 2018 at 18:22 history edited ecjb CC BY-SA 4.0
added 286 characters in body
Oct 5, 2018 at 17:58 comment added EdM Try a restricted cubic spline transformation of your risk_factor. Without fully learning the rms package you can still load it to get its rcs() function for a standard coxph() call, for example: coxph(Surv(time,status)~ rcs(risk_factor,3), for a spline with 3 knots (you might want/need to use more). Plot martingale residuals from the coxph object with the spline transformation against risk_factor; a reasonably flat line shows you handled non-linearity with the spline. You'll have to plot that yourself as ggcoxfunctional() only shows residuals from the null model.
Oct 5, 2018 at 17:36 comment added ecjb Thanks (again!) for the good tip @Edm. I changed the axes of the graphs and updated the pictures. I still don't see a model which is definitely better than the other ones.
Oct 5, 2018 at 17:31 history edited ecjb CC BY-SA 4.0
added 111 characters in body
Oct 5, 2018 at 17:23 comment added ecjb Thank you very much for the very helpful comment @Edm. I'm trying to read all the details in the link you provided. It seems that the rms package is a package to be used when dealing with survival although I have to say that the survivaland survminerpackages are more beginner friendly. As I did a univariate cox regression, obtaining the Martingale residuals could be a good option. I performed the 2 transformations of variables. So I guess that now I have to choose the transformation that looks the most like a straight line. But none of the plots seem to do the job well
Oct 5, 2018 at 17:23 comment added EdM The default choice of axis limits in ggcoxfunctional is not very good, as you might infer from discussion on the pages I linked to above. Specify the limits yourself (with xlim and ylim arguments) so that the y axis covers a range between -2 and +1 and so the x axis covers the complete range of your data, and post the new graphs instead, for a more complete look at what you have.
Oct 5, 2018 at 17:15 history edited ecjb CC BY-SA 4.0
added output
Oct 5, 2018 at 17:10 history edited ecjb CC BY-SA 4.0
added output
Oct 5, 2018 at 17:02 history edited ecjb CC BY-SA 4.0
edited title
Oct 5, 2018 at 16:48 history edited ecjb CC BY-SA 4.0
edited title; edited title
Oct 5, 2018 at 15:12 comment added EdM The answer might depend on correlations with other predictors and numbers of events. Please read this answer, which includes information about using martingale residuals or splines of the continuous predictor to evaluate linearity; also this page for related discussion and some useful links. If you still have unanswered questions on evaluating linearity with respect to your log-transformed continuous predictor, please edit this question to provide the further details that you need clarified.
Oct 5, 2018 at 13:58 history asked ecjb CC BY-SA 4.0