Skip to main content
Bumped by Community user
edited tags
Link
kjetil b halvorsen
  • 82.8k
  • 32
  • 201
  • 663
Source Link
user248711
user248711

Set new reference level for hazard ratios

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?