Skip to content
Prev 279966 / 398513 Next

p-value for hazard ratio in Cox proportional hazards regression?

Hi Thierry,

I see what you want now---a significance test for the HR specifically.
 See inline below

On Sat, Dec 10, 2011 at 6:40 PM, Thierry Julian Panje
<tpanje at stanford.edu> wrote:
That is correct.
I am hoping someone else will chime in here.  I might naively try this
(but do validate before publishing).  For the standard error of the
hazard ratio, I use exp(coef) * se, and then assume that (exp(coef) -
1)/(exp(coef) * se) is ~ x2(1).  A quick look through Terry Therneau's
book, Modeling Survival Data did not turn up any particular ways to
get this automatically in R.  Note that the confidence interval (and
this is consistent with summary()) is based on exponentiating the
linear predictor's lower and upper limits, not the SE of the
exponetiated predictor.

require(survival)
set.seed(1)
d <- data.frame(
  start = start <- sample(1:10, 600, TRUE),
  stop = start + sample(1:7, 600, TRUE),
  event = event <- rbinom(600, 1, .7),
  x1 = event * rbinom(600, 1, .7),
  x2 = rnorm(600, 0, 1))

m <- coxph(Surv(start, stop, event) ~ x1 + x2, d)
beta <- coef(m)
se <- sqrt(diag(vcov(m)))
HR <- exp(beta)
HRse <- HR * se

summary(m)
round(cbind(coef = beta, se = se, z = beta/se, p = 1 - pchisq((beta/se)^2, 1),
  HR = HR, HRse = HRse,
    HRz = (HR - 1) / HRse, HRp = 1 - pchisq(((HR - 1)/HRse)^2, 1),
    HRCILL = exp(beta - qnorm(.975, 0, 1) * se),
    HRCIUL = exp(beta + qnorm(.975, 0, 1) * se)), 3)
"usual" probably depends on the area.  I have seen the coefficients
presented with p-values, and the 95%CI of the hazard ratio.  I do not
know that there is any one required set of statistics to be reported.
No, it is a nonlinear transformation and the p-values are not the same.
Aspects are not, but aspects are.  Certainly, asking if there is a way
to get a test of the hazard ratio in R (without hacking something
together like I did) seems reasonable to me at least to ask.

Cheers,

Josh