Hakim
Hakim

Reputation: 1

Deviance residuals diagnostics on a Cox model with 13 independent covariates - any way I can get plots for each and every covariate?

I am new to survival statistics and to these forums, so forgive me for not knowing the lingo or the proper way of inquiry. WIll give it my best shot.

I am aiming to perform some cox regressions and want to do some basic diagnostics on its goodness of fit. I have about 13 covariates and when I perform ggcoxdiagnostics I am able to get a deviance residual plot. However, this plot is representative of the entire cox model as such and I have found it skewed. I'd therefore like to perform the same analysis but for each and every covariate in the Cox model in order to see which covariate is sticking out and in possible need of transformation (log, cubic spline, polynomial, etc.).

I simply don't know how to make this happen. What code should I use?

library("survminer")

res.cox = coxph(Surv(TimeAxis, new_totmort) ~ pwvX_AUS + MAP_PWV_AUS + A_HRcarX_AUS + sex_AUS + age_scr_AUS + BMI_AUS + glukos_0_AUS + Current_smoking_AUS + BPlowering_AUS + Lipidlowering_AUS + Hypertension_AUS + Diabetes_confirmed_AUS + Had_CV_Treatment + FH, data = A)

ggcoxdiagnostics(res.cox, type = "deviance")

Upvotes: 0

Views: 403

Answers (1)

Oka
Oka

Reputation: 1328

You can

(1) try to get separate residuals for each variable by using other types of residuals(= score or Schoenfeld residuals). With them one value for each variable is being returned, so this should work and it is pretty straightforward to use them:

ggcoxdiagnostics(res.cox, type ="score")
ggcoxdiagnostics(res.cox, type ="schoenfeld")

(2) Stick to using deviance residuals and leave out or modify/transform one variable at a time and check if the outcome is improved graphically from the residuals.

You cannot - get multiple residuals for a subject with deviance residuals: with deviance residuals you get only one residual value returned for each subject. It is stated in documentation that "...For ..deviance residuals, the returned object is a vector with one element for each subject ".

Upvotes: 0

Related Questions