3
$\begingroup$

I am using R and coxph() to fit a Cox proportional hazard model. When I plot the deviance residuals using

ggcoxdiagnostics(fit, type = "deviance", linear.predictions = FALSE)

they appear to have a slight negative bias.

Deviance residuals of unsorted data

If I sort my data such that the individuals that had an event are grouped together at the end, I notice that teir residuals have much higher variance, and seem to have a slight positive bias:

Deviance residuals of sorted data

I can see the same effect for type="dfbeta. Schoenfeld residuals look fine, and are non-significant except for one variable (p=0.038). Is this something to be expected?

$\endgroup$

1 Answer 1

2
$\begingroup$

This page provides a succinct summary of the different types of residuals for Cox models. As it says:

Unlike Martingale residuals, deviance residuals are mean centered around 0, making them significantly easier to interpret than Martingale residuals when looking for outliers.

So that "they appear to have a slight negative bias" in your data might be an optical illusion. (Check that the ggcoxdiagnostics plot hasn't truncated the y-axis in some way.)

Deviance residuals are best used for finding outliers. Yes, you have a wide range of residuals but (at least on these plots) none that seem outrageously worse than others.

The linked page also points out:

A positively valued deviance residual is indicative of an observation whereby the event occurred sooner than predicted; the converse is true for negatively valued residual.

Censored cases can only be found to have events that occur later than predicted. In your second plot, the deviance residuals for the censored cases are thus all negative. The cases with events, in contrast, have known event times so that their residuals can be positive or negative. Together with the requirement that the mean deviance residual is 0, you get the general shape of that plot.

$\endgroup$
2
  • $\begingroup$ Thanks! I am actually mostly concerned about the large disparity in variance, as I am not aware of any theoretical reason for that. My concern is that the dataset comes from a retrospective study, and originally included only the event group, which is obviously nonsense. The control group was later incorporated, presumably using the same inclusion criteria, but I have my doubts about the validity of the data (I have no role in the study itself, I just have to deal with the results. Not ideal, I know...). $\endgroup$ Nov 30, 2020 at 12:27
  • 1
    $\begingroup$ @user11130854 the large "variance" difference of deviance residuals between censored and un-censored cases has a practical basis: you know actual event times for non-censored cases, so there are explicit (and widely distributed) differences between expected and observed event times. For censored cases, all you know is that an event might have happened at some time after the predicted time; unless you have very long follow-up for a censored case you won't have a very large negative deviance residual. Although deviance residuals seem like they should be useful, they can disappoint in practice. $\endgroup$
    – EdM
    Nov 30, 2020 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.