title: How to apply time transformation to a factor variable in cph( ) function
body: <p>Hi I'm currently trying to fit a cox regression model but when I run the cox.zph() function, my p value is constantly smaller than 0.05 with the Delay variable being a major issue. It is a binary factor variable (0 or 1) describing whether a patient had early (0) or delayed (1) treatment. So from what I read on how to deal with this issue I tried to apply the tt() function to the Delay variable as such:</p>
  <pre><code>cox.death &lt;- cph(Surv(diff, event)~tt(Delay)+rcs(age,3)+female+rcs(hba1c,3)+rcs(bmi,3)+rcs(egfr,3)+rcs(sbp,3),
                     data=cox.model, x = T, y = T)
  </code></pre>
  <p>But then I get this error message: <code>Error in tt(Delay) : could not find function &quot;tt&quot;</code>
  I'm not quite familiar with the rms package but is there any solution to this problem? Thanks!</p>