6

I'm using R's coxph function to fit a survival regression model, and I'm trying to model time dependent covariates (see this vignette). When fitting the model, I get the following error:

Error in aeqSurv(Y) : aeqSurv exception, an interval has effective length 0

Other than the source code, I couldn't find any references to this error online. Would appreciate any ideas about how to handle this exception.

Adam Haber
  • 683
  • 1
  • 6
  • 8
  • If you could provide the `Surv` object via `dput` I trust you could get some help. The error sound to me like for some events `time == time2`:`Surv(time, time2, event...)` – missuse Oct 28 '17 at 13:35
  • Did you find a solution to this? I had code which was working fine for years and I even had workspaces saved that, when I ran the models, worked fine. But recently I've been getting this error as well. Has something changed in the coxph or Surv functions? – finstats Mar 06 '18 at 00:04
  • Looks like this error arises with R v. 3.4.3. When I downgraded to version 3.3.3 everything worked again. Hope this works for you. – finstats Mar 06 '18 at 03:13

3 Answers3

4

I found the same error. Probably the cause is the aeqSurv routine that treats time values such that tiny differences are treated as a tie. This is actually useful and the error is potentially pointing an issue with the data.

However, if we need to force a solution you can use the coxph.options. Just setting timefix = FALSE in the call to coxph should make the trick!

Source: https://rdrr.io/cran/survival/src/R/aeqSurv.R

0

I had this error after I used the survSplit function to make time intervals, prior to fitting with coxph. I noticed that survSplit introduced trailing digits (i.e., 20 days turned into 20.0 days). So I removed those digits with the round function and it worked.

LeslieKish
  • 414
  • 1
  • 4
  • 11
0

Like the above answer, adding the control variable in the coxph function should solve the problem. Please see the reference: https://github.com/therneau/survival/issues/76

model <- coxph(formula = Surv(time1, time2, event) ~ cluster(cluster), 
               data = dataframe, 
               control = coxph.control(timefix = FALSE)) # add the control variable 
Calvin
  • 1
  • 1