I would like to use Cox model to predict hospital length of stay. My data is as follows: Patient ID Length of stay Sex Comorbidity 1 Comorbidity 2 Comorbidity 3 Diagnosis Age Ethnic group Blood Test results

I am a beginner to the Cox model and I am not sure how to fit variables into Surv() function. The time will be LOS, but there is no event (status) in my data as every patient gets discharged at some point. Is it the right way to fit Cox model for LOS coxph(Surv(data$los) ~ data$Age + data$Ethnic_group + other predictors) ?

  • 1
    $\begingroup$ It seems you do not have censoring data (every patient gets discharged at some point), so there are other statistical methods that is better or equal to survival analysis (cox PH model belongs to survival analysis). $\endgroup$
    – user158565
    Jun 5, 2019 at 4:15
  • $\begingroup$ Thank you, looking at literature, it is a very popular method for my problem and it was strongly recommended to me to use it, so there must be a way to use it in these circumstances. $\endgroup$
    – Robin
    Jun 5, 2019 at 6:34
  • 1
    $\begingroup$ It is popular because they do not know the reason that we need survival analysis. $\endgroup$
    – user158565
    Jun 5, 2019 at 15:18

1 Answer 1


In this type of situation, the event is discharge. The "hazard" at time $t$ then represents the "risk" of being discharged at that time, given that the individual hasn't yet been discharged. So a high hazard ratio for one of the covariates would represent a relationship with an earlier discharge time.

So if you are using the R survival package and all patients in your study were discharged, then you could specify a value of 1 for the status of all individuals. You don't even have to do that, as the manual page for the Surv() function says:

Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event.

That said, it's not clear how you would be modeling patients who died before discharge. You need to think about that, if that's possible for the patients that you are studying.

I also have a hunch that you might have difficulty with documenting that the proportional-hazards assumption holds if most discharges are early but some are very late.

As I suspect that most discharges occur well before 30 days, there will be a lot of ties in your event times if you have a large enough study to handle 8 or more predictors (you'd probably need about 100 cases at least). Cox models can handle ties. See this page for further discussion, and suggestions for other approaches like parametric survival models.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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