0
$\begingroup$

I run a Cox Regression and afterwards, I predicted the Hazard Ratio (HR) for the predictor values 1 to 10. My data looks something like this:

mydata <- data.frame(values= 1:11,
                     hr_pred= c(.2, .4, .5, .6, .9, 1,
                                1.2, 1.4, 1.8, 2.1, 2.2))

The reference predictor value is 6, i.e. this is the predictor value where HR is 1. I want the reference to be 5. Can I simply divide all the HR values by the HR value of predictor= 5 to achieve that? my approach is like this:

new_ref_value <- 5
mydata$hr_new_ref <- mydata$hr/ mydata$hr[mydata$values == new_ref_value]

mydata
values hr_pred hr_new_ref
1       1     0.2  0.2222222
2       2     0.4  0.4444444
3       3     0.5  0.5555556
4       4     0.6  0.6666667
5       5     0.9  1.0000000
6       6     1.0  1.1111111
7       7     1.2  1.3333333
8       8     1.4  1.5555556
9       9     1.8  2.0000000
10     10     2.1  2.3333333
11     11     2.2  2.4444444

Is this the right way to do it?

$\endgroup$

1 Answer 1

1
$\begingroup$

I figured it out myself and want to share it so maybe it helps others with the same question. It's a little odd answering own question but as I read this is quite acceppted or even encouraged.

Anyway, I found this great vignette by Terry Therneau, where he describes how to set a new reference after running a cox regression. I compared the results to the results of the idea I posted in the question and they are the same! So at this point I would say yes, one can recalculate the hazard ratio as suggested in the question.

# load library
require(survival)

# fit model
mfit <- coxph(Surv(futime, death) ~ sex + pspline(age, df=4), data=mgus)

# predictions
ageterm <- termplot(mfit, se=TRUE, plot=FALSE)$age

# choose a reference level
ref_value <- 55

# changing reference as in Terry Therneau
center <- with(ageterm, y[x== ref_value])
ytemp <- ageterm$y + outer(ageterm$se, c(0, -1.96, 1.96), '*')
hr_therneau <- exp(ytemp - center)

# changing reference as suggested in my question
hr_my<- exp(ytemp)/ exp(ytemp[ageterm$x == ref_value, 1])

# same results?
all.equal(hr_therneau, hr_my)
# TRUE
$\endgroup$

Your Answer

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