title: What is the default of the time transform function in the coxph command?
body: <p><strong>Short introduction:</strong></p>
  
  <p>A Cox Proportional Hazards (PH) model can be estimated with the <code>coxph</code> function of the <code>survival</code> package. An obvious requirement to get sensible results from this type of model is that the hazards are proportional, i.e., they are constant over time. If this is not the case for a certain variable, it can be solved by making the coefficient of this variable time varying. (Now it is technically an extended Cox model.) This is done by adding the <code>tt()</code> to that variable and specifying a function over time (see <code>vignette("timedep", package = "survival")</code> page 19+).</p>
  
  <p><strong>Question:</strong></p>
  
  <p>Which function is used if <code>tt()</code> is used without specifying a function?</p>
  
  <p>Here is an example:</p>
  
  <pre><code>library(survival)
  data(lung)
  cox_model &lt;- coxph(Surv(time, status) ~ age + sex + ph.karno, data = lung)
  cox_model_ph &lt;- cox.zph(cox_model) 
  #              rho    chisq       p
  # age      0.00701  0.00871 0.92566
  # sex      0.12249  2.42336 0.11954
  # ph.karno 0.23135  8.24167 0.00409
  # GLOBAL        NA 11.54750 0.00911
  </code></pre>
  
  <p>We see that <code>ph.karno</code> violates the PH assumption (small p-value), so add <code>tt()</code>:</p>
  
  <pre><code>cox_model_tt &lt;- coxph(Surv(time, status) ~ age + sex + tt(ph.karno), data = lung)
  cox_model_tt_ph &lt;- cox.zph(cox_model_tt)
  #                   rho  chisq      p
  # age          -0.00907 0.0142 0.9052
  # sex           0.12844 2.7270 0.0987
  # tt(ph.karno)  0.11643 2.3846 0.1225
  # GLOBAL             NA 5.0220 0.1702
  </code></pre>
  
  <p>Now the PH assumption is satisfied, but I have no idea what the <code>tt()</code> function actually did. I tried some common used function such as <code>tt = function(x, t, ...) x*t</code>,  <code>tt = function(x, t, ...) x + t</code>, <code>tt = function(x, t, ...) x*log(t)</code>. But all gave different results (and were unable to fix the PH violation).</p>
  
  <p>Any help is appreciated.</p>