0

I have my data in long format correctly yet when I run the coxph function:

tryu <- coxph(Surv(entry,exit,dead==1) ~ age, na.action=na.omit,data=finalmerge)

I get the following error:

Warning message:

In Surv(entry, exit, dead == 1) :
  Stop time must be > start time, NA created

But none of my exit times are larger than the entry times and none of them are missing? How can I get this to work??

Thanks

avariant
  • 2,234
  • 5
  • 25
  • 33
  • do you have a sample dataset to recreate your error and understand it ? – demarsylvain Jan 30 '19 at 21:32
  • wouldn't you want ALL of your exit times to be larger than your entry times? Also, try explicitly specifying your variables. It may be trying to put exit into event, so `Surv(time=entry,time2=exit,...)` – c.custer Jan 30 '19 at 21:35

1 Answers1

0

We need to see your data use dput(head(mydata)) You should use an interval and maybe you have an issue with the arguments :

interval <- exit - entry
event <- dead == 1
tryu <- coxph(Surv(time = interval,event = event) ~ age,
 na.action=na.omit,data=finalmerge)
  • Also, I apologize as I had meant all the stop times were larger than the start times so the error did not make sense but using this code as suggested above helps the issue. – user5298556 Jan 31 '19 at 16:58