coxph with tt and id gives error
Closed this issue · 2 comments
tgbrooks commented
Running coxph
using both the tt
and id
parameters gives an error
Error in residuals.coxph(fit2, type = "dfbeta", collapse = cluster, weighted = TRUE) :
Wrong length for 'collapse'
For example (gives error with version 3.2.13):
bladder1 <- bladder[bladder$enum < 5, ]
coxph(Surv(stop, event) ~ (rx + tt(rx) + size + number),
id = id, bladder1,
tt = function(x,t,...) x*t)
If this is not allowable use, it would be nice to have a more understandable error and some mention of this in the documentation of coxph
. It looks like the work around is to also specify cluster = id
. Is there any problems with doing that?
therneau commented
I will take a look at this. I have never tried using id and tt in the same model myself, nor had anyone ever ask about this edge case before.
therneau commented
Now fixed in my code; a simple oversight.