This particular post follows the final part of fitting a Cox proportional hazards model; residual checking and model validation.
Solutions can be found for these exercises here.
Load the survival and survminer libraries. Build our previously derived final Cox model.
Calculate Martingale residuals and build a dataframe of these residuals with a second index column.
Plot your Martingale residuals now.
In a similar way to above, calculate deviance residuals, incorporate them into your residual data frame, and plot.
Calculate the linear predictors of your final model and plot against your deviance residuals.
You may need to use ggrepel here to handle label positioning.
Build a new dataframe containing dfbeta values for each variable within your final model.
Using a for loop, plot each of these dfbeta residuals.
With graphical residual plots created, formally test that the PH assumption has been met for your final model.
Plot this now to graphically confirm your test.
With all residuals and model checking complete, visualise your final survival curve generated by your model.