Hospital emergency departments (EDs) operate under significant pressure worldwide. Overcrowding is a frequent occurrence, caused by a combination of high presentation numbers, and long delays in the admission of patients due to a lack of availability of hospital beds. Understanding the factors which influence length of stay (LoS) in the ED is a vital aspect of any strategy to improve patient flow. The determinants of ED patient flow are complex and varied, due to the diverse population of patients competing for limited resources. This research uses Coxian phase-type distributions to cluster patients into groups by their LoS, using a unique diagram for improved communication of patient flow issues. A novel application of survival analysis is presented to simultaneously evaluate the effect of patient attributes, system factors, and overcrowding on ED LoS. The approach is demonstrated with an application to data from a hospital in South Australia.