Search code examples
rsurvival-analysiscox-regression

How do I get output of the cummulative Hazard ratio from coxph?


How do I get output of the cummulative Hazard ratio from coxph?

I have my coxmodel

coxfit <- coxph(Surv(combi$survival, combi$realdeath) ~ combi$meanrr, combi)

and get the output

# Call:
# coxph(formula = Surv(combi$survival, realdeath) ~ combi$meanrr, 
#     data = combi)
# 
#                   coef exp(coef)  se(coef)     z       p
# combi$meanrr -0.004140  0.995869  0.000905 -4.57 4.8e-06
# 
# Likelihood ratio test=21.9  on 1 df, p=2.94e-06
# n= 311, number of events= 70 

I know I can calculate the Hazard Ratio manually with hr = exp(-0.004140) and the ci= exp(-0.004140-1.96*0.000905),exp(-0.004140+1.96*0.000905)

This will give me the HR of an increase of one unit with confidence interval.

Is there a function which will give me the results as a vector or data.frame? Preferentially if I could define the number of units of interest, like

somefunction(coxfit, unit_step)

but just calculating the cumulative hazard ration is fine


Solution

  • summary(coxfit) gives the correct answer

    coxph(formula = Surv(combi$survival, realdeath) ~ meanrr, data = combi)
    
      n= 311, number of events= 70 
    
                 coef  exp(coef)   se(coef)      z Pr(>|z|)    
    meanrr -0.0041399  0.9958687  0.0009055 -4.572 4.83e-06 ***
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    
           exp(coef) exp(-coef) lower .95 upper .95
    meanrr    0.9959      1.004    0.9941    0.9976
    
    Concordance= 0.661  (se = 0.035 )
    Rsquare= 0.068   (max possible= 0.92 )
    Likelihood ratio test= 21.86  on 1 df,   p=2.938e-06
    Wald test            = 20.9  on 1 df,   p=4.83e-06
    Score (logrank) test = 21.24  on 1 df,   p=4.051e-06
    

    where the hazard ratio for one units increased is given as exp(coef) and the confidence interval as lower/upper .95