0

Dealing with data in Cox PH model with exclusively right censoring. My understanding from reading is that right censored data does not contribute to the analysis under Cox models - however a quick experiment shows me that they do affect the HR's and the shape of the survival curve.

library(survival)

n <- 5000
id <- 1:n
sex <- ifelse(rbinom(n, 1, 0.5)==0, "F", "M")
age <- runif(n, 20, 100)
death <- rbinom(n, 1, age/100 )

df1 <- data.frame(id, sex, age, death)

mod1 <- (coxph(Surv(time=age, event=death) ~ sex, df1))

df2 <- df1[df1$death==1,]
mod2 <- (coxph(Surv(time=age, event=death) ~ sex, df2))

summary(mod1)
summary(mod2)

plot(survfit(mod1))
plot(survfit(mod2))

So df2 and thus model2 consists of only the people who experience the outcome. If the right censored folks in model1 don't contribute to the analysis to my mind the results from both analyses should be the same - but comparing the regressions and curves they are not.

What am I missing here ?

user2498193
  • 1,072
  • 2
  • 13
  • 32
  • 1
    On question 1: my intuition thinks it might have something to do with the very small difference in the distribution of sex between df1 and df2 (as you can see, the estimates are very similar). On question 2 (cbind): cbind converts to a matrix and a matrix can only hold one variable type. You don't need it, you can do `data.frame(id,sex,age,death)`. – Heroka Aug 19 '15 at 08:51
  • Q1 - well the curves still look different if you remove sex from the model (i.e. `Surv(time=age, event=death) ~ 1`. I need to understand this. Q2 - Thanks!! Case closed! – user2498193 Aug 19 '15 at 08:55
  • From some extra reading I think I understand. The right censored patients don't contribute to the numerator at all, but they do contribute to the denominator - as long as they each are followed. When one is censored the denominator therefore decreases slightly. Since the denominator is pretty big, such losses don't have a dramatic step function effect, but instead have a gradual effect - resulting in the subtle differences in curve the above shows. At least this is what I think is happening. Can someone with expertise confirm please ? – user2498193 Aug 19 '15 at 10:51

0 Answers0