Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSuggestion: plot Time in the OX axis in ggcoxdiagnostics() #124
Comments
|
I think that a solution is provided by the function @pbiecek what do you think about that? If this solution is optimal, then we can close the issue... Example: library("survival")
# Fit cox model
res.cox <- coxph(Surv(time, status) ~ age + sex + wt.loss, data = lung)
# Test for the proportional-hazards assumption
test.ph <- cox.zph(res.cox)rho chisq p age -0.0483 0.378 0.538 sex 0.1265 2.349 0.125 wt.loss 0.0126 0.024 0.877 GLOBAL NA 2.846 0.416 # Graphical diagnostic using the function ggcoxzph()
# Produces, for each covariate, graphs of the scaled Schoenfeld residuals against the time
library(survminer)
ggcoxzph(test.ph)More examples are provided in the documentation: http://www.sthda.com/english/rpkgs/survminer/reference/ggcoxzph.html |
|
The ggcoxzph() function is great, especially for people used to survival::cox.zph() (like me). Returning to ggcoxdiagnostics(). |
|
Yeah, I agree with you and I think that, we should definitively go for adding the option, you suggested, in the Thanks:-)! |
|
Thank you for the pull request:-)! |

Right now the
ggcoxdiagnostics()may have either Fitted values of Observation ID on the OX axis.To choose one can set the
linear.predictions.But for some residuals (like schoenfeld) it is convenient to plot Time on the OX axis.
Suggestion: replace the
linear.predictionsparameter withox.scale = c("linear.predictions", "time", "observation.id").This will allow more choices for OX scale.
@MarcinKosinski what do you think about this?