Cox Proportional Hazards Model

UVA Biostatistics Discussion Board: Regression Modeling Strategies: Cox Proportional Hazards Model
By Osman Al-Radi on Saturday, May 10, 2003 - 06:28 am:

Non-proportional hazards for a categorical predictor:

f<-cph(Surv(time.status)~age+sex+dm+rx,x=T,y=T)

The main treatment variable (rx) failes the PH assumption test of cox.zph() in a cph() model..

I would like to model the non-proportional effect..

If I include rx:time interaction the model fails to converge!

How can I model the non-proportionality ? I do not want to subset by time because this results in two or more models with less events in each and I do not have enough dfs..

I would appreciate any suggestions..

Osman

By Frank E Harrell Jr (Feh3k) on Saturday, May 10, 2003 - 09:08 pm:

The simplest way to allow for non-proportional hazards for a categorical variable such as rx is to stratify on it (strata(rx) for coxph, strat(rx) for cph). And note that if you do not want to use stratification, you can't just interact follow-up time with a covariate if you want to use time-dependent covariates. See coxph documentation or the Therneau & Grambsch book for how to do that.

By Osman Al-Radi on Saturday, May 10, 2003 - 11:44 pm:

Dear Prof. Harrell,

Thank you for your quick response (even during the weekend)..

I do not want to stratify by treatment (rx) because the model in this case
dose not allow inferences about rx which is the aim of the study..

The second option in Therneau and Grambsch is to partition the follow-up
time.. essentially get two or more models.. Unfortunately this reduces the
number of events in each phase of follow-up and I can not afford that in
terms of the number of dfs I need to adjust for baseline differences in this
observational study..

The third option which is the basis of my question is to model the
non-proportionality by including a time-dependent covariate.. here the T&G
book suggest using SAS PHREG to include such a variable (a function of the
survival time).. I may have to do that but I was wondering if there is a way
of doing that in S (I do not believe that is described in the book)

I am grateful for your help..

Osman

By Frank E Harrell Jr (Feh3k) on Sunday, May 11, 2003 - 07:23 am:

Inference will not be easy for the effect of rx if you use time-dependent covariates. And depending on how you slice the time axis and model the interaction between time and rx, the "time-slicing" approach using the coxph or cph functions will have the same spending of d.f. and increase in variance as the continuous time interaction method that is easy to do with SAS PHREG. Note also that you can have continuous time interactions with coxph; it will just require the creation of a large dataset.

By Osman Al-Radi on Friday, May 16, 2003 - 05:20 pm:

Dear Prof. Harrell:

I have used PROC PHREG to model the time dependence..
PROC PHREG data=temp;
model time*status(0) = age sex dm rx rx_time /ties=effron;
rx_time=rx*(time/365.25);
run;

it works fine. And I get significant p-values for both rx and rx_time. And I calcuated beta rx (t)s manullay.

However, I find it dificult to validate and calibrate the PHREG models in SAS.. So I wanted to try creating an expanded data set to input into cph().. I found a function called expand.breakpoins() on the s-news website (PS thanks to the author John Maindonald).. It easly created the expnaded dataset.. however I still get a error message 'singular matrix' using cph() or coxph()
f2<-cph(Surv(Tstart, Tstop, status)~age + sex + dm + rx + rx:Tstop ,x=T,y=T)

What am I doing wrong?

By Frank E Harrell Jr (Feh3k) on Saturday, May 17, 2003 - 07:43 am:

I don't know, but validate and calibrate for models fitted using cph are not intended to work with time-dependent covariates.

By Osman Al-Radi on Sunday, May 18, 2003 - 11:11 am:

Hello..

It worked all what I had to do was to create the interaction term before the cph() or coxph() function:

rx.time<-rx*(Tstop/325.25)
f2<-cph(Surv(Tstop,Tstart,status)~age+ sex+ dm+ rx +rx.time, x=T, y=T)

then to get time specific beta (and hazard ratio) I manullay calcuate:

beta rx (at 3 years)=beta rx + (3 * beta rx.time)
var(beta rx (3 years) = var(beta rx) + (3 * var (beta (rx.time))

Too bad the calibrate and validate functions don't work with time-dependent covariates..

Prof. Harrell, I am grateful for your help.

Osman

By Frank E Harrell Jr (Feh3k) on Sunday, May 18, 2003 - 05:34 pm:

In computing the variance there should also be a covariance term. You might use predict to compute the standard error more automatically. Also look at contrasts.Design and summary.Design. And don't forget that the Therneau and Grambsch book is a "must read".

By Osman Al-Radi on Wednesday, May 21, 2003 - 03:52 pm:

Dear Prof. Harrell,

Thank you for the hint about predict() it makes life easy..

I attempted to use a frailty term within cph() but it behaves diferently form coxph() :

fit3
Call:
coxph(formula = Surv(Tstart, Tstop, died) ~ demograph + acuity + comorbidity +
coronary + repair + repair.time + frailty(surg, df = 2), data =
large.imr)
...
frailty(surg, df = 2) 2.28 2.04 0.3300

Iterations: 3 outer, 11 Newton-Raphson
Variance of random effect= 0.0547 I-likelihood = -296.4
Degrees of freedom for terms= 1 1 1 1 1 1 2
Likelihood ratio test=41.6 on 7.95 df, p=1.56e-006 n= 7859

fit3.cph

Cox Proportional Hazards Model

cph(formula = Surv(Tstart, Tstop, died) ~ demograph + acuity + comorbidity +
coronary + repair + repair.time + frailty(surg, df = 2), data =
large.imr)
.....
surg -0.0643 0.0400 -1.608 0.1078
>

I wonder if this is similar to the strata versus strat issue? and if there is a way to get results the same as coxph()

Regards

Osman

By Frank E Harrell Jr (Feh3k) on Wednesday, May 21, 2003 - 07:27 pm:

cph does not support frailties. Stay with coxph for that.