[R] Modeling time varying effects in with cph: how to ?

Marco Barbàra jabbadhutt at libero.it
Sun May 23 01:01:53 CEST 2010

Dear R users,

I know, this is the second time i return on this topic. Sorry, but this
analysis is of great value for me, and i hope someone can help me.

I need to model a time-varying effect in a Cox model. Briefly explained



It seems that SAS is more well-suited to this purpose, as explained
in the links above, but i do not have enough time to learn SAS.  
I think i should use something like this:


but i'm not sure, specially after Thernau's reply to my previous post.

Assuming i'm doing well, i'd prefer to use cph because of the
rms bootstrap validation facilities.

Unfortunately cph doesn't wanto to model an interaction term without
the both corresponding main effects: 

> fit.cph <- cph(TACE.Surv~PS+PS:TIME.start,data=DatasetTACE.imputati)
Error in if (!length(fname) || !any(fname == zname)) { : 
  missing value where TRUE/FALSE needed

coxph runs without complaining.

I could make the design matrix columns by hand, but this is generally
not recommended, isn't it?

Any sort of comment will be appreciated.

Thank you very much.

Marco Barbàra.

More information about the R-help mailing list