1
$\begingroup$

I have 2 questions:

  1. Why doesn't the 'tt' option in Coxph() in R estimate both a linear and a quadratic effect when you include "tt=function(x,t,...) x * I(t^2)" or "tt=list(function(x,t,...)x * t,function(x,t,...)x * I(t^2))" ? All I see in the output is tt(var), instead of tt(var * time) and tt(var * time^2).

  2. How do I specify different time effects for different variables? After defining 'tt' I can only apply it to variables as a whole, so var1 is forced to have the same time interaction as var2. I may want one to be linear and the other quadratic, for example.

This may be mostly a programming question but it's possible I'm misunderstanding a concept related to time-dependent effects

$\endgroup$
0

1 Answer 1

0
$\begingroup$

As a tt() term is an attempt to fit a functional form that isn't constant in time for a predictor's coefficient, it doesn't make sense to have multiple tt() terms for the same predictor in the model. What you want is a single time-varying adjustment to what the predictor (without the extra time dependence) would provide.

In fact, R won't even let you do that. This quote from Section 5 of the time-dependence vignette answers your questions:

If there are multiple tt() terms in the formula, then the tt argument should be a list of functions with the requisite number of elements. One footnote to this, however, is that you cannot have a formula like log(bili) + tt(age) + tt(age). The reason is that the R formula parser removes redundant terms before the result even gets to the coxph function.

You can specify different tt() functions for different predictors in a list of functions, but I think that you have to have the order within the list in the same order as the tt() terms appear in the formula. If the number of tt() terms and the number of elements of the list of tt() functions doesn't agree, the software might silently choose just the first element of the list.

As I understand it, a standard polynomial in a tt() function won't result in separate coefficient estimates for each polynomial term. If you want a flexible fit for the time course, recent versions of the survival package provide the nsk() function that you can incorporate into a tt() function to allow for a regression spline fit. See Section 4.2 of the vignette. That returns separate coefficients associated with spline terms: "the coefficient􏰃s are the predicted values at knots 2, 3, . . . - the predicted value at knot 1."

Splines are much more reliable than standard polynomials for regression modeling, unless you have a strong theoretical reason for a particular polynomial form. I can't think of how you would have such a theoretical justification for a single polynomial for the time course of a Cox model's regression coefficient.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.