 Research article
 Open Access
 Published:
Crowding in the emergency department in the absence of boarding – a transition regression model to predict departures and waiting time
BMC Medical Research Methodology volume 19, Article number: 68 (2019)
Abstract
Background
Crowding in the emergency department (ED) is associated with increased mortality, increased treatment cost, and reduced quality of care. Crowding arises when demand exceed resources in the ED and a first sign may be increasing waiting time. We aimed to quantify predictors for departure from the ED, and relate this to waiting time in the ED before departure.
Methods
We utilised administrative data from the ED and calculated number of arrivals, departures, and the resulting queue in 30 min time steps for all of 2013 (N = 17,520). We build a transition model for each time step using the number of past departures and prespecified risk factors (arrivals, weekday/weekend and shift) to predict the expected number of departures and from this the expected waiting time in the ED. The model was validated with data from the same ED collected March through August 2014.
Results
We found that the number of arrivals had the greatest independent impact on departures with an odds ratio of 0.942 (95%CI: 0.937;0.948) corresponding to additional 7 min waiting time per new arrival in a 30 min time interval with an a priori time spend in the ED of two hours. The serial correlation of departures was present up to one and a half hour previous but had very little effect on the estimates of the risk factors. Boarding played a negligible role in the studied ED.
Conclusions
We present a transition regression model with high predictive power to predict departures from the ED utilising only system level data. We use this to present estimates of expected waiting time and ultimately crowding in the ED. The model shows good internal validity though further studies are needed to determine generalisability to the performance in other settings.
Background
Crowding in the emergency department (ED) can be defined as a situation where demand exceed the resource supply (i.e. beds, nurses, doctors etc.) and is associated with increased mortality, increased treatment cost, and reduced quality of care [1,2,3,4,5,6,7]. Asplin et al. has proposed a conceptual model of crowding that incorporates risk factors associated with crowding dividing patient flow in the ED into input (arrivals, high proportion of complex or critically ill patients and restricted access to general practice), throughput (internal processes, staffing, delay in test results), and output (departures, inpatient boarding) [7,8,9]. We have previously shown that crowding can be described with a general black box queuing model [10] and found that in particular the input to the ED drives the queue length (i.e. the number of patients in the ED) in a given 30 min time interval.
While several studies [11,12,13,14,15] have investigated patientlevel factors (e.g. sex, age, ethnicity, and acuity level) associated with length of stay in the ED, analysing crowding in the ED using systemlevel data (e.g. day of week, work shift etc.) is a less explored approach [16, 17]. This method has the advantage that the investigated factors can be anticipated to a high degree and staffing can be planned accordingly.
Methods
The aim of the present study was to model the probability of a departure from the ED dynamically as a function of the number of arrivals and the queue length given weekday or weekend and work shift (day, evening, or night) thus quantifying the effect of these previously identified risk factors for crowding in the ED [10]. We will use the model to estimate the expected waiting time in the ED – from arrival to departure – under different scenarios. We adhere to the Strengthening the Reporting of Observational Studies in Epidemiology statement (https://www.strobestatement.org).
Study site
We obtained data from the ED unit at Aarhus University Hospital, Denmark. The ED attends to approximately 40,000 patients per year from an uptake area of 330,000 inhabitants and receives all acute orthopaedic, trauma, and unstable medical patients from this area. Patients with other surgical and medical needs are also attended in the studied ED though not exclusively in this unit. Patient groups that are not received in the ED include medical paediatric and psychiatric patients as well as patients with cardiac arrest and myocardial infarction (these were transferred to specialised departments). When admitted to the ED unit patients are treated and discharged or admitted to the hospital. See Additional file 1 for details of the studied ED and the study population.
Study design and population
We used an open cohort design including patients from 1. January 2013 to 31. December 2013. From the Electronic Health Records (EHR) we obtained data on arrivals to and departures from the ED including time stamps. The total number of arrivals was 41,693.
We created an aggregate data set with census of arrivals A(t) and departures D(t) in 30 min intervals (N = 24 * 2 * 365 = 17,520). The queue length at the beginning of a new interval (t + 1) was calculated from the queue length, number of arrivals and departures in the previous interval (t):
with the initial queue length Q(0) = 0.
To mirror the clinical setting we defined a day as beginning with the day shift at 7 a.m. with each work shift lasting eight hours. To reduce the effect of the arbitrary choice of the initial queue length (Q(0) = 0) the first three shifts of the study period were excluded in the statistical analysis.
A statistical model for the number of departures
We expected serial or lagged correlation of the departures (correlation of two observations of departure as a function of the time between them, also known as “autocorrelation”) and thus utilised a transition model for each time step (present departures) with conditional analyses on past departures (as predictor variables) together with the prespecified predictor variables (risk factors) to predict the expected number of present departures [18]. The transition model is formulated as a binomial regression model for each time step t, where the number of trials is equal to the maximum number of possible departures (n(t) = Q(t) + A(t)) and the number of successes corresponds to the actual number of departures D(t), i.e. D(t) ~ Bin(n(t), p(t  t1)), where p(t  t1) is the probability of a departure in time step t dependent on past values.
In binomial regression models it is standard to express the probability p for given values of the predictors through the logit function (as in logistic regression):
In our setting we used this expression for each time step with predictors that include both the number of past departures to handle the time dependent transition step and the prespecified predictor variables
Due to the logit model each regression parameter can be expressed as an odds ratio (OR) by exp(β(i)) = OR(i).
The prespecified predictor variables were new arrivals, weekday/weekend and shift (day, evening, or night) since these have been shown to be important risk factors for crowding [10]. We also included queue length in the previous time interval as well as the change in queue length to the current time interval. Our previous study indicated interaction between weekday/weekend and work shift why this was included in the model as well. We tested the overall interaction by chi^2 test (ANOVA method).
Relating the model to waiting time
We will use “waiting time” in the meaning of “waiting to leave the ED”, synonymously with the term “lengthofstay” (ED LOS), counting from the time of arrival until the time of departure from the ED disregarding the fact that much imperative work  such as assessment, treatment etc.  is being done during this time. Thus, here “waiting time” is a matter of queueing terminology and should not be taken literally.
Assuming that the queue length is in steady state the number of departures will follow a geometric distribution and hence the expected time spend from arriving to the ED in a given 30 min time interval until leaving the ED (immediate waiting time) can be estimated in hours as
where p is the probability of a departure. The ratio between waiting time in two scenarios with departure probabilities p(1) and p(0) is
that is, the inverse OR between the departure probabilities can be interpreted as the factor by which the expected waiting time changes.
Diagnostics
From the binomial model we calculated for each time step the expected number of departures (fitted) as E(t + 1) = E(D(t + 1)) = n(t + 1) * p(t + 1  t), where p(t + 1  t) is considered as the onestepahead prediction for the probability of departure and is estimated through the logitexpression given above. We plotted the standardised residuals against the fitted values to check for the assumptions of linearity, homoscedasticity, and independent errors (Fig. 2). To confirm normality of the residuals we plotted the standardised residual quantiles against the theoretical quantiles (“Normal QQ plot”, Fig. 2). We evaluated the goodnessoffit by the null and residual deviance.
Model validation
We used a new dataset from the same ED but collected during 6 month of 2014 (March 1st to August 31st) to evaluate how well our final model captures the observed data. We evaluated the model fit the same way as for the model presented above but using parameter estimates from the original data (Additional file 2).
Data management, analysis and plots were done in R, version 3.3.2 (R Foundation for Statistical Computing, Vienna, Austria). The code is available together with a constructed example of the dataset in the GitHub repository https://github.com/eiset/Crowding_code.git
Results
In the study period, approximately 3% of the patients stayed less than 30 min in the ED and 5% stayed longer than 5 h. The ED had 19 beds and was staffed with 4 to 8 nurses depending on time of day and week. A detailed description of the study population and site can be found in [10].
The serial correlation on previous departures was present up to one and a half hour previous (OR = 1.008 to 1.012).
New arrival (OR = 0.942) and change in queue length (OR = 0.978) had the greatest impact on lowering the odds of a departure. In a “standard scenario” of weekday day shift, with an empty queue for at least the past one and a half hour the waiting time for one patient arriving to the ED is given by the transition model as
See Table 1 for all OR estimates including confidence intervals and the corresponding impact on waiting time.
Weekday/weekend did not have an isolated effect but did show interaction with work shift (overall test for interaction p < 0.0001) with a higher probability for a departure in weekends evening and night shift as compared to weekday day shift (see Table 2).
From Fig. 1 of the onestepahead expected and the observed number of departures (together with number of arrivals and the resulting queue length) we find that the model predicts departures fairly well with a close relation to the observed development over time. The random variation in the observed numbers around the time curve of the expected numbers show no clear evidence against the model, e.g. systematic over or underfitting (see also Additional file 3 for more figures of randomly chosen days).
All diagnostic plots suggested that the binomial model adhered to the assumptions underlying the model (Fig. 2).
Discussion
We present a transition model quantifying predictors for departures from the ED taking into account the serial correlation of departures. The number of arrivals has the greatest effect on the departure probability and hence the waiting time. With only 5% of patients spending more than 5 h in the ED boarding was not a concern in the studied ED.
The expected waiting time rises with 6% – corresponding to around 7 min with an average a priori waiting time of two hours – per additional arrival in a 30 min time interval. Under this scenario, everything else being equal, the expected waiting time with three new arrivals will rise from 2 h to 2 h and 22 min in the duration of 30 min. Figure 1 shows that on 28. May at 12:30 the queue length rose to 26 patients. In the previous time intervals the queue length was 14 and the average waiting time was estimated to 4 h and 18 min data not shown). Everything else being equal, the previous queue length of 14 results in approximately 36 min additional waiting time in the time interval beginning at 12:30. To add to this, the queue length’s increase of 12 patients from the beginning of the previous time interval to the beginning of the interval at 12:30 gives a further increase of approximately 60 min waiting time. Additional file 4 shows a table of the development in expected waiting time for a day with few (80) arrivals and a day with many (147) arrivals. We also include a boxplot for comparison of the average waiting time in the two scenarios (Additional file 5).
The number of new arrivals may be associated with a broad range of predictable e.g. large festivals and recognised epidemics) and unpredictable (e.g. accidents and unrecognised epidemics) events. This number will, to a high degree, be random and hence hard to predict and to base any action upon. Contrary, a rise in the queue length as compared to the past 30 min time interval is easily monitored and is associated with a decreased probability of a departure as well. It indicates a vicious cycle beginning (growing queue length  > fall in departures/longer waiting time  > growing queue length  > …) and may very well be an early sign of crowding in the ED which can be countered. The PlanDoStudyAct tool could be utilised in implementing such intervention [19].
The predetermined predictors’ coefficients were nearly unchanged when we did not include the serial (departure) correlation in the model. This indicates that it is to a lesser degree the throughput processes that affects whether or not a patient is likely to spend a long time in the ED: The “internal system” (throughput processes) remains the same through 30 min intervals. This is in accordance with our previous results and other studies [10, 11] though not unambiguously reported [14, 20].
Contrary to the conclusion of Bashkin et al. [16] we found no indication that departures or queue length is associated with shift changes (Fig. 1). This could be due to a more appropriate structuring of the handover between shifts in the studied ED or that Bashkin et al. have exclusively looked at throughput processes to explain departures and crowding and thus not included other confounders in their analysis. Wiler et al. [17] find an independent effect of weekend (compared to weekday), which we could not reproduce. We did however find an effect of the interaction of shift and weekend. It may be this interaction that was not investigated in the Wiler study or it may be that the organisation of the EDs under study or their respective uptake population is different in a way that produce the divergent result.
The chosen binomial model assumes that the probability of departure is homogeneous across patients in a given time interval, but it seems likely, that heterogeneity in e.g. triage scores (red patients) can cause heterogeneity in the departure probabilities. Due to the number of missing values on the triage score this predictor could not be included in the model.
All diagnostics as well as Fig. 1 (and Additional file 3) indicate that the model describes the data well. Our validation of the model showed an equally good fit indicating a high internal validity [21,22,23]. There may however still be a question of the external validity to other settings: EDs that are substantially different organised, different population characteristics in the uptake area, etc. Further validation studies are needed to determine this.
The EHR contains prospectively collected data to be used in a clinical setting. This makes EHR a secondary data source when used in research: We (the researchers) had no control over the data collection process, which might make EHR data questionable for research [24]. The time stamps for arrival and departure is considered to be very reliable in the studied ED and any errors are likely to be random. If systematic error exists  e.g. if at times of increasing strain on the ED staff the time stamps of departures were registered with delay (i.e. differential misclassification [23])  this would lead to bias in the reported OR for departures (in the example given it would lower the OR related to queue length). Other possible predictors on a systemlevel to include in the model is season, weather condition, epidemics (e.g. influenza), large events in the area (e.g. music festivals), staffing of personnel other than nurses (e.g. doctors), and organisational and psychological interactions that may particularly play a role in times of increased strain on the staff such as in situations with crowding [25]. We have previously found that season plays a minor role in predicting crowding [10] and did not have data on the other variables to investigate their effect. Predictors for crowding on patientlevel have been thoroughly examined and include age, sex, and acuity level of patients present in the ED [11,12,13,14, 26] but could not be included in the presented model (see above).
Conclusions
We present a regression model to predict departures from the ED in the absence of boarding. We use this to present estimates of expected waiting time and ultimately crowding in the ED. Our model follows the recommendations by McCarthy et al. [27] for measuring crowding: It is highly generic – requiring data on only arrivals and departures – and dynamic with measurements in 30 min time steps.
Abbreviations
 95%CI:

95% confidence interval
 A:

Arrivals
 D:

Departures
 E:

Expected
 ED:

Emergency department
 EHR:

Electronic health record
 LOS:

Lengthofstay
 OR:

Odds ratio
 t:

Time interval
 WT:

Waiting time
References
Bernstein SL, Aronsky D, Duseja R, Epstein S, Handel D, Hwang U, et al. The effect of emergency department crowding on clinically oriented outcomes. Acad Emerg Med. 2009;16(1):1–10.
Carter EJ, Pouch SM, Larson EL. The relationship between emergency department crowding and patient outcomes: a systematic review. J Nurs Scholarsh Off Publ Sigma Theta Tau Int Honor Soc Nurs Sigma Theta Tau. 2014;46(2):106–15.
Fee C, Hall K, Morrison JB, Stephens R, Cosby K, Fairbanks R, Terry J, et al. consensusbased recommendations for research priorities related to interventions to safeguard patient safety in the crowded emergency department. Acad Emerg Med Off J Soc Acad Emerg Med. 2011;18(12):1283–8.
Hwang U, McCarthy ML, Aronsky D, Asplin B, Crane PW, Craven CK, et al. Measures of crowding in the emergency department: a systematic review. Acad Emerg Med. 2011;18(5):527–38.
Moskop JC, Sklar DP, Geiderman JM, Schears RM, Bookman KJ. Emergency department crowding, part 1—concept, causes, and moral consequences. Ann Emerg Med. 2009;53(5):605–11.
Schuur JD, Hsia RY, Burstin H, Schull MJ, Pines JM. Quality measurement in the emergency department: past and future. Health Aff (Millwood). 2013;32(12):2129–38.
Morley C, Unwin M, Peterson GM, Stankovich J, Kinsman L. Emergency department crowding: a systematic review of causes, consequences and solutions. PLoS One. 2018;13(8):e0203316.
Asplin BR, Magid DJ, Rhodes KV, Solberg LI, Lurie N, Camargo Jr. CA. A conceptual model of emergency department crowding. Ann Emerg Med 2003;42(2):173–180.
Hoot NR, Aronsky D. Systematic review of emergency department crowding: causes, effects, and solutions. Ann Emerg Med. 2008;52(2):126–136.e1.
Eiset AH, Erlandsen M, Møllekær AB, Mackenhauer J, Kirkegaard H. A generic method for evaluating crowding in the emergency department. BMC Emerg Med. 2016 Dec [cited 2016 Jun 21];16(1). Available from:; http://bmcemergmed.biomedcentral.com/articles/10.1186/s1287301600834.
Chaou CH, Chen HH, Chang SH, Tang P, Pan SL, AMF Y, et al. Predicting length of stay among patients discharged from the emergency department—using an accelerated failure time model. PLoS One. 2017;12(1):e0165756.
Chaou CH, Chiu TF, Yen AMF, Ng CJ, Chen HH. Analyzing Factors Affecting Emergency Department Length of Stay—Using a Competing Riskaccelerated Failure Time Model. Medicine (Baltimore). 2016 Apr 8 [cited 2017 May 9];95(14). Available from: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4998795/
Gardner RL, Sarkar U, Maselli JH, Gonzales R. Factors associated with longer ED lengths of stay. Am J Emerg Med Phila. 2007;25(6):643–50.
Kreindler SA, Cui Y, Metge CJ, Raynard M. Patient characteristics associated with longer emergency department stay: a rapid review. Emerg Med J. 2016;33(3):194–9.
Pines JM, Russell Localio A, Hollander JE. Racial disparities in emergency department length of stay for admitted patients in the United States. Acad Emerg Med. 2009;16(5):403–10.
Bashkin O, Caspi S, Haligoa R, Mizrahi S, Stalnikowicz R. Organizational factors affecting length of stay in the emergency department: initial observational study. Isr J Health Policy Res. 2015;4(1):38.
Wiler JL, Handel DA, Ginde AA, Aronsky D, Genes NG, Hackman JL, et al. Predictors of patient length of stay in 9 emergency departments. Am J Emerg Med. 2012;30(9):1860–4.
Diggle P, Heagerty P, Liang KY, Zeger S. Analysis of longitudinal data. Second ed. Oxford, New York: Oxford University Press; 2013. p. 400. (Oxford Statistical Science Series)
McHugh M, Dyke KV, McClelland M, Moss D. Improving patient flow and reducing emergency department crowding [internet]. 2011 [cited 2017 May 9]. Available from: /research/findings/finalreports/ptflow/index.html.
Kawano T, Nishiyama K, Hayashi H. Execution of diagnostic testing has a stronger effect on emergency department crowding than other common factors: a crosssectional study. PLoS One. 2014;9(10):e108447.
Keiding N, Louis TA. Perils and potentials of selfselected entry to epidemiological studies and surveys. J R Stat Soc Ser A Stat Soc. 2016;179(2):319–76.
Pearl J, Bareinboim E. External validity: from docalculus to transportability across populations. Stat Sci. 2014;29(4):579–95.
Rothman KJ, Greenland S, Lash TL. Modern Epidemiology. 3rd edition. Philadelphia: Lippincott Williams & Wilkins; 2008.
Sorensen HT, Sabroe S, Olsen J. A framework for evaluation of secondary data sources for epidemiological research. Int J Epidemiol. 1996;25(2):435–42.
Bagust A, Place M, Posnett JW. Dynamics of bed use in accommodating emergency admissions: stochastic simulation model. BMJ. 1999;319(7203):155.
Pines JM, Russell Localio A, Hollander JE. Racial disparities in emergency department length of stay for admitted patients in the United States. Acad Emerg Med Off J Soc Acad Emerg Med. 2009;16(5):403–10.
McCarthy ML, Ding R, Pines JM, Zeger SL. Comparison of methods for measuring crowding and its effects on length of stay in the emergency department. Acad Emerg Med Off J Soc Acad Emerg Med. 2011;18(12):1269–77.
Acknowledgements
Not applicable
Funding
The authors received no specific funding for this work.
Availability of data and materials
Under Danish law raw data obtained from EHR cannot be published. Data are available from the Danish Institutional Data Access / Ethics Committee (contact Danish Data Protection Agency and Danish Health and Medical Authorities) for researchers who meet the criteria for access to confidential data.
The Rcode for the data management as well as the analysis is available together with a constructed example of the dataset in the GitHub repository, https://github.com/eiset/Crowding_code.git.
Author information
Authors and Affiliations
Contributions
AHE performed all data management, analysis, and drafted the manuscript. ME made the analysis plan. AHE, ME, and HK contributed in the interpretation of the results, read, and approved the final manuscript.
Corresponding author
Ethics declarations
Ethics approval and consent to participate
Permission to conduct the study has been granted from the Danish Data Protection Agency (2007580010) and the Danish Health and Medical Authorities (3–3013552/1/). No further approval was required for this study in Denmark.
Consent for publication
Not applicable
Competing interests
The authors declare that they have no competing interests.
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Additional files
Additional file 1:
Table of characteristics of the emergency department and the patients. Friday and Saturday nights were considered part of the weekend. *The ED unit has two additional beds reserved for trauma call patients. Adapted from Eiset et al. (TIF 1490 kb)
Additional file 3:
Figure of arrivals, departures (observed and expected), and queue length in the study period. The 12 days have been randomly chosen (one for each month in 2013) eight times. Departures are plotted as negative for visualisation. Abbreviations: obs., observations; expt., expected; arr., arrivals. (PDF 1111 kb)
Additional file 4:
Table of the expected waiting time in a scenario with few and many arrivals. Two examples of the number of arrivals and departures, the resulting queue length and probability of departure, and the waiting time estimate based on this data. The examples are chosen to show the contrast of a day with few arrivals and a day with many arrivals (the graphs of predicted arrivals etc. can be seen in Additional file 3). It exemplifies how arrivals can drive the waiting time e.g. in the time interval beginning at 15:00: The queue length were the same and twice as many (2 and 4, respectively) left the ED on the 5th September. But while there were four patients that arrived on the 5th eight arrived on the 20th. This resulted in a waiting time estimate of 2 h and 39 min and 1 h and 59 min, respectively. It is also clear that arrivals are not the only factor that influence waiting time. The change in queue length is seen to be important exemplified in the time intervals beginning at 7:30 and 8:00 both on the 5th September. Here nothing but the queue length changed (rises from 1 to 3 patients, respectively) and the waiting time increasing with 5 min. See Additional file 5 for a boxplot of the waiting time. *Waiting time estimated in hours as 0.5 * (1 – p) / p, where p is the probability of a departure. (PDF 41 kb)
Additional file 5:
Boxplot, illustrating the median and inter quartile range (IQR) of the waiting time on the 20th October and 5th September 2013. The median estimated waiting time was 1 h and 48 min (IQR = 27 min) on the 20th October and 2 h and 13 min (IQR = 40 min) on the 5th September. The notch indicates the estimated 95% confidence interval for the median. The individual observations are jittered. See Additional file 4 for a table of arrivals, departures and expected waiting time for each 30 min time interval. (TIF 425 kb)
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated.
About this article
Cite this article
Eiset, A.H., Kirkegaard, H. & Erlandsen, M. Crowding in the emergency department in the absence of boarding – a transition regression model to predict departures and waiting time. BMC Med Res Methodol 19, 68 (2019). https://doi.org/10.1186/s1287401907103
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s1287401907103
Keywords
 Emergency department
 Crowding
 Prediction model
 Waiting time
 Transition regression model