## Figures

## Abstract

Environments such as shopping malls, airports, or hospital emergency-departments often experience crowding, with many people simultaneously requesting service. Crowding highly fluctuates, with sudden overcrowding "spikes". Past research has either focused on average behavior, used context-specific models with a large number of parameters, or machine-learning models that are hard to interpret. Here we show that a stochastic population model, previously applied to a broad range of natural phenomena, can aptly describe hospital emergency-department crowding. We test the model using data from five-year minute-by-minute emergency-department records. The model provides reliable forecasting of the crowding distribution. Overcrowding is highly sensitive to the patient arrival-flux and length-of-stay: a 10% increase in arrivals triples the probability of overcrowding events. Expediting patient exit-rate to shorten the typical length-of-stay by just 20 minutes (8.5%) cuts the probability of severe overcrowding events by 50%. Such forecasting is critical in prevention and mitigation of breakdown events. Our results demonstrate that despite its high volatility, crowding follows a dynamic behavior common to many systems in nature.

**Citation: **Parnass G, Levtzion-Korach O, Peres R, Assaf M (2023) Estimating emergency department crowding with stochastic population models. PLoS ONE 18(12):
e0295130.
https://doi.org/10.1371/journal.pone.0295130

**Editor: **Yong-Hong Kuo, University of Hong Kong, HONG KONG

**Received: **July 10, 2023; **Accepted: **November 15, 2023; **Published: ** December 1, 2023

**Copyright: ** © 2023 Parnass et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **A minimal dataset, with the hourly entries and exits is available on Kaggle (https://www.kaggle.com/datasets/gilparnass/ed-crowding-by-hour).

**Funding: **Israel Science Foundation grant no 521/20 for Michael Assaf. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript. The Kmart foundation for Renana Peres. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript. None of the authors received salary from the funder. No further funding was neither from the institution nor from any other source.

**Competing interests: ** The authors have declared that no competing interests exist.

## Introduction

We live in a crowded world. Crowded environments such as shopping malls, trains during rush hours, airports, performance venues, religious sites, and hospital-emergency-departments [1–3] are characterized by an influx of arriving individuals, each seeking to receive a service that is often customized to their needs, and sometimes includes clear prioritization criteria. As a result, the exit rate, and thus the number of individuals present at any given moment, greatly fluctuates across hours and days, with high volatility and sudden "spikes" of overcrowding.

Modeling crowding has been a major challenge in disciplines such as operations research, marketing, transportation research, psychology, and healthcare management [4–21].

A considerable body of research focused on describing the average behavior in the population (e.g., arrival rate, length of stay, probability of making a specific decision based on crowding etc.). These models typically implemented methodologies such as queuing models [11,12], econometric analysis [4–9], time series analysis [10] (Kadri, Harrou, Chaabane, & Tahon, 2014), dynamic choice models [13,14], and performance analysis [16] (Chan, Farias, Bambos, & Escobar, 2012). While these methods are powerful for capturing average behaviors, they are less suitable for analyzing the fluctuating nature of crowding. Indeed, as demographic fluctuations typically scale as the square root of the population size, such models become less accurate in modeling environments with smaller populations. In particular, these models do not account for outliers, bursts, and large overcrowding spikes, which characterize crowding dynamics, and at their extreme may lead to catastrophic events such as unreasonable waiting times, service breakdown, or crowd disasters.

To better capture the stochastic nature of crowding, a class of discrete event simulation studies [18,22–26] has been proposed. These models typically simulate a specific context (e.g., transportation choices by passengers [23](Cats, West, & Eliasson, 2016), hospital-emergency-department [18,22,26], and pedestrian crowds congestion [24](Lachapelle & Wolfram, 2011)), by decomposing it into stages, defining the inter-stage transition flow, and examining this flow subject to the parameters of the environment. For example, Kuo et al 2016 develop a simulation model in order to improve the efficiency of a Hong Kong hospital ED [18] (Kuo, Rado, Lupia, Leung, & Graham, 2016). The simulation mimics the journey of a patient through the various stages of the ED process, incorporating a large number of ED parameters, and inferring service-time distributions from the data. Such models are powerful and allow exploration of ED operations aspects; yet, due to the large number of context specific parameters they use, their output is valuable only when the model closely resembles the real system [27](Vanbrabant, Braekers, Ramaekers, & Van Nieuwenhuyse, 2019).

Other methods which incorporate stochasticity are based on machine-learning algorithms [15,19,28,29]. While these methods provide better predictions, their “black box” nature makes it harder to draw interpretable insights. Moreover, lacking an analytical framework, these models provide less insight into the relative effect of each of the model’s parameters on overall crowding [19](Kuo, et al., 2020).

Here we suggest a different approach to modeling crowded environments. We show that despite its high volatility and spiky nature, crowding can be accurately described using a simple, generalizable model, with a minimal number of parameters. Our model formulates a Langevin stochastic differential equation [30,31], which describes the dynamics of the number of patients at any given moment, and includes noise terms which account for heterogeneity in the incoming individuals, as well as variability from the side of the service provider. While the model is compact and its basic version can be solved analytically, it captures both the average behavior as well as the stochastic nature of crowded environments, including large deviations and spikes, while still enabling conducting parameter exploration and gaining key insights on the formation of crowding and the possible avenues for its mitigation.

Rooted in population dynamics, our approach connects individual-level responses with changes in population density and structure [32](Maltby, et al., 2001), as well as environmental variability. These models have been used to describe fluctuating population dynamics in ecology [33,34], population biology [35,36], epidemiology [37,38], cell biology [39–44], statistical physics [45](Assaf & Meerson, Extinction of metastable stochastic populations, 2010), and even turbulence [46–48]. This paper is a novel attempt to use them to address crowding effects.

We implement the model in the context of hospital emergency departments (EDs). ED crowding constitutes a prevalent, enduring, and progressively escalating global challenge worldwide [49]. EDs regularly face crowding [50–52], with many experiencing daily occurrences of overcrowding conditions [53]. ED overcrowding has been shown to harm patient satisfaction [54,55], and lead to compromised safety, timeliness and effectiveness of patient care [4,5,56–58], patient attrition [6,56,59], and even higher mortality rates [9,56]. ED crowding is a major factor in the fatigue of medical staff [50], and a contributing factor to violent incidents [60]. Therefore, mitigating ED crowding has been a top priority for health authorities and policy makers [56,61].

ED crowding has been intensively studied [10–13,15,16,18–22,28,29], exploring a variety of operational metrics [27], and using variety of modeling techniques (see Hu, Barnes and Golden 2018 [20], Vanbrabant et al. 2019 [27], and Sinreich and Marmor 2005 [25] for review). Our model offers a fourfold contribution: First, it captures average behavior, as well as spikes and events of overcrowding, which received less research attention [10–13]. Second, our model is compact. Compared with the discrete event models [18,25], it uses only two parameters, and can offer a closed-form solution and therefore a more generalizable outlook. Third, being based on a general Langevin formulation, it allows comparison with a broad class of population-related phenomena in other research domains. Four–unlike machine learning models [15,19,28,29], our model is interpretable and enables to test the impact of changes in specific variables on the overall outcomes. Therefore, it complements the literature to provide a more generalizable and interpretable understanding of crowding, explore spikes and outliers, and connect crowding population behaviors.

We test our model on a proprietary dataset which includes the complete set of records of 679,762 ED visits over five years. We find that despite its high volatility and spiky nature, ED crowding follows a dynamic behavior common to many systems in nature. The model provides reliable forecasting of the average as well as the overall hourly crowding distribution. More importantly, due to its analytical nature, the model can predict how the overcrowding probabilities vary with the model parameters. This ability, absent from various discrete event and machine learning models, is an important tool in understanding ED overcrowding and is a first step towards exploration of means for prevention of ED breakdowns.

## A stochastic population model for crowding

We first present the basic notations and dynamics through a mean-field deterministic model, wherein noise is ignored, and then develop the complete stochastic model. The mean-field deterministic representation is formally valid in the limit of an infinite population.

### Mean-field deterministic model

Assume a service venue where individuals arrive at flux rate denoted by *f*(*t*) and exit at rate *β*(*t*). The dynamics of the mean number of individuals in the venue reads:
(1)

Here, both the arrival flux and exit rate explicitly depend on time, as these constantly vary during the day. Starting with *n*_{0} individuals, the solution to Eq (1) reads:
(2)

Solution (2) radically simplifies by approximating *f*(*t*) and *β*(*t*) by their time-averages: , and . In this case, , i.e., the mean number of individuals converges, after a timescale of , to the stable fixed point at

### Stochastic model

In actual crowded environments, besides their deterministic variations, the arrival flux and exit rates contain a stochastic component. We therefore incorporate two types of noise into the mean-field dynamics: inter-individual, and systematic. The first type, inter-individual noise, emanates from heterogeneity in the arrival flux, discreteness of individuals, or the type of service sought by each individual, and is sometimes termed *demographic*, or *internal*. To account for the latter, we write down the so-called *master equation*–a gain-loss equation describing the evolution of the probability *P*_{n}(*t*) of observing *n* patients at time *t*, where time is continuous. For the process which includes influx and exits at rates *f*(*t*) and *β*(*t*) respectively, the master equation reads [31]:
(3)

A useful approximation of the master equation, valid in the limit of large *n*, is the so-called *Langevin equation* [31] [see SI, Appendix A in S1 File]–a stochastic differential equation for the momentary number of patients at the venue. For the stochastic process at hand, the Langevin equation reads [31]: . This equation includes a deterministic term, *f*(*t*)−*β*(*t*)*n*(*t*), identical to Eq (1), and a noise term, , representing the inter-individual noise [30,45] [see SI, Appendix A in S1 File], where *ξ*_{1}(*t*) is a stochastic variable defined below.

Notably, our model also includes a second noise source which is absent from the above Langevin equation. This noise, termed *systematic noise* or *external noise*, is caused by changes in the facility infrastructures, variations in the number and quality of staff, and inconsistencies in organizational procedures. With this additional noise term, which directly affects the exit rate from the ED, the Langevin equation becomes:
(4)
where apart from the deterministic and demographic-noise terms, we added to the model a second noise term, *β*(*t*)*ξ*_{2}(*t*)*n*(*t*) which corresponds to the systematic noise. It is multiplicative and scales with the population size [62], as it equally influences all individuals. We assume that the two stochastic variables, *ξ*_{1}(*t*) and *ξ*_{2}(*t*), are mutually independent, zero-mean, delta-correlated (in time) noise terms with magnitudes *σ*_{1} and *σ*_{2}, respectively, such that 〈*ξ*_{i}(*t*)〉 = 0, and , where *δ*(*τ*) is the Dirac delta function. Notably, we have confirmed that taking *ξ*_{i} with finite correlation time (i.e., colored noise, when *ξ*_{i} satisfies, e.g., an Ornstein-Uhlenbeck equation [31]), does not qualitatively change the model’s results [see SI, Appendix B in S1 File]. Here, it is important to note that, a qualitatively similar equation to Eq (3) can in principal be obtained using methods from queuing theory, by taking a processor-sharing server with capacity scaling linearly with the population size *n*, and adding external noise to the capacity [63].

The solution of Eq (4) provides the time trajectory of the momentary number of patients, *n(t)*, for a single noise realization. However, since we are interested in the complete statistics of events, including events of extreme overcrowding, we solve the equation for multiple realizations. A histogram over the different realizations provides the complete statistics of events. Alternatively, this histogram can be computed by transforming Eq (4) into a Fokker-Planck equation [31] (see SI, Appendix A in S1 File).

## ED data

We assembled a unique dataset containing the complete records of 679,762 visits by 333,471 unique patients, which are all the ED visits between January 1st, 2013 and June 30, 2018, at the Shamir Medical Center, a large state-run Israeli hospital. Each record represents a visit by a single individual, and for each such record the dataset contains, inter alia, an encrypted patient identifier (to enable tracking of revisits), reason for visit, gender, age, mode of arrival (ambulance vs. self-arrivals), triage urgency, lab test timings and results, and all of the medical decisions for the patient. The data include time of arrival to and time of departure from the ED (discharge or hospitalization), as well as time stamps for each recorded operation; thus, each visit-log contains a minute-by-minute description of the patient visit. 46.4% of the patients were females, 24% under age 18 and 23% age 65 or older. The most common reasons for arrival are sickness (72% of cases) and injury (16%). The average length of stay in the ED is 3.9 hours, with a standard deviation (STD) of 2.6 hours.

We use the weekly hour (e.g., Sunday 8:00–9:00) as a basic time unit, due to the population’s strong weekly cycle, with high typical crowding during weekdays (Sunday-Thursday, following the Israeli workweek), and lower crowding on the weekend (Friday-Saturday). To align with the ED shift structure, we grouped the hours, when needed, into morning (7:00–15:00), afternoon (15:00–23:00), and night (23:00–7:00) shifts. To demonstrate the spiky nature of the data, we show in **Fig 1** the momentary number of patients normalized by their hourly mean, for a typical period of 4 weeks. During this period, one has ~15−16 spikes exceeding the mean by 50%, and ~4 spikes exceeding the mean by 100%, indicating a quite significant noise level.

## Crowding metrics

Research and practice suggest various ways to measure ED crowding, differing in the data they require and purpose of measurement. Some methods capture the inflow of patients (total number of daily visitors, current number of patients being treated or waiting to be seen), while others capture the load experienced by the patients or the staff (waiting times, treatment times, patients who leave without being seen, nurses being rushed or feeling rushed, etc.). A considerable number of measures focus on the facility’s physical infrastructures (number of available beds, capacity in observation area, patients placed in ED hallways, etc.), see [64] for review.

A popular measure is the National Emergency Department Overcrowding Score (NEDOCS) [61], officially used by the USA federal authorities. This score is a multi-variable function based on both site-specific parameters (total beds in the ED, Number of hospital beds), and momentary indices (total number of patients, average waiting time, etc.). For this research, we measure four metrics: arrival flux, exit flux, momentary number of patients, and ’’patient hours’’.

The arrival flux *f*(*t*) is the hourly number of incoming patients (**Fig 2**A). The exit flux is the number of patients who left the ED per hour for both discharge and hospitalization, see (**Fig 2**B). The momentary number of patients is the number of patients who are currently in the ED, denoted by *n*(*t*) (**Fig 2**C). Finally, the metric of patient hours, which was specifically developed for this research, is defined by (see the grey area under the curve in **Fig 2**C and **2**D). This is the accumulated number of patients in the ED during the time interval [*T*, *T*+Δ*T*], where T is measured in hours. That is, if the shift began with 100 patients, and they all remained throughout the shift, the patient hours for that shift will be 800. While the measure of patient hours, which is a combination of several other commonly used measures [65], does not account for factors such as bed availability, waiting times, etc., its key advantage is that it is easier to integrate over shifts and days, and therefore, is more suitable for forecasting future ED occupancy.

Timeline of the arrival flux (A), exit flux (B), and momentary number of patients in the ED (C). The solid line is the hourly value for a typical week (July 5–12, 2015); the shaded blue area denotes one standard deviation from the average over all weeks. The grey area in (C) denotes the value of the patient hours for the Monday afternoon shift. (D) Distribution of patient hours per shift. The box extends from the 25th to the 75th percentile of the shift data (whiskers mark the 5th and 95th percentile), with a line at the median. A week begins at 7:00 on Sunday, while the vertical grid–lines represent the shifts (07:00, 15:00 and 23:00).

## Crowding statistics

The average hourly arrival flux of patients in our data is 14 (STD = 8, min = 0, max = 46). The average hourly exit flux of patients is likewise 14 (STD = 7, min = 0, max = 46). The fact that their average coincides naturally indicates that there is no long-term accumulation of patients. The average momentary number of patients present in the ED (as recorded hourly) in our data is 55 (STD = 27, min = 3, max = 161), while the average patient hours per shift is 440 (STD = 164, min = 130, max = 1,198).

**Fig 2** demonstrates strong daily and weekly cycles. Most of the patients arrive in daytime, and most of them, even those who arrived in the afternoon or evening, tend to leave before the late nighttime. During weekends, there are fewer patients in the ED than during the week. **Fig 2**D depicts the distribution of patient hours per shift. The afternoon shift (15:00–23:00) is typically more crowded than the morning or night shifts, and the workweek is more crowded than the weekend, with the first day of the workweek (Sunday) being the most crowded.

**Fig 3** shows the average hourly arrival flux over a week and the probability of a patient to remain in the ED since arrival. The latter is illustrated in **Fig 3**B, where for each cohort of patients arriving at a given time *t*_{0}, shown is the percentage of the remaining patients at *t*>*t*_{0}. The graph exhibits a clear exponential-like decay with a constant decay factor *β*>0. It is convenient henceforth to define the exit flux and exit rate as the hourly number and hourly fraction of patients who left the ED, respectively. Thus, *β*(*t*) represents the exit rate, or the rate at which a patient exits the ED (discharged, hospitalized) within the next hour. The higher *β*(*t*) is, the faster the patient turnover, and therefore *β* may be a good metric for the ED efficiency.

(A) The average hourly arrival flux over a week. (B) The probability of a patient to remain in the ED since arrival versus time (a semi–logarithmic plot). The red line is an exponential approximation, indicating that the patients’ exit process is a Poisson process, with an expected value that equals the patients’ average length of stay.

## Estimating crowding

### Estimation procedure

The model in Eq (3) requires the estimation of the arrival flux *f*(*t*), the exit rate *β*(*t*), and the noise magnitude parameters *σ*_{1} and *σ*_{2}. We take *f*(*t*) as the empirical arrival flux, averaged over the various weeks (**Fig 3**A). Notably, other theoretical choices of the arrival flux are possible, for example, by fitting the data to a trapezoid function of time for each day. We confirmed (see SI, Appendix C in S1 File) that this choice provides results with comparable accuracy to those shown below.

For the exit rate *β*(*t*), the data indicate that individuals exit the ED in a Poisson manner, i.e., the probability of not exiting until time *t* is given by *p*(*t*) = *e*^{−βt} (**Fig 3**B). That is, the individual exit rate can be regarded as a constant number *β* that depends on the specific day of the week (altogether four *β* parameters: Sunday, midweek (Monday-Thursday), Friday, and Saturday).

We estimated the model parameters using a two-step process: first, we estimated the deterministic *β* parameters, and then the stochastic components *σ*_{1}, *σ*_{2}. The *β* parameters were estimated using solution (2) to the mean field Eq (1) for the constant *β* case. The estimated *β* values are presented in **Table 1**. **Fig 4** shows the model’s results for the mean exit rate (**Fig 4**A), mean number of patients (**Fig 4**B) and mean patient hours (**Fig 4**C) compared with empirical data.

Comparison between the data (blue) and the model (red) for the average exit flux (A), average momentary number of patients (B) and the average patient hours per shift (C). Here *R*^{2} equals 0.929 (A) and 0.956 (B).

The confidence interval represents the range of parameter values within 1 standard deviation (STD).

In the second step, we used the values of *β*, and applied maximum likelihood estimation to fit the noise parameters, *σ*_{1} and *σ*_{2}. For every point in their two-dimensional parameter space ** σ** = (

*σ*

_{1},

*σ*

_{2}), we ran 10

^{4}realizations of a simulated week, calculating the hour-by-hour STD, denoted by

*S*(

**,**

*σ**t*), and compared it to the data hourly STD,

*S*

_{i}. Here,

*S*

_{i}=

*S*

_{i}(

*t*

_{i}) is comprised of

*n*points of time denoted by

*t*

_{i}(measured in hours). We estimated

**by maximizing the Likelihood function: (5) where we assumed that the sampled data have additional white Gaussian noise with variance**

*σ**p*

^{2}. The Gaussian assumption is justified as the hourly arrival flux exhibits a Poisson distribution, which, in the limit of large numbers, and especially in the right tail of the distribution, can be regarded as a Gaussian.

By differentiating the log-likelihood function with respect to ** σ** and

*p*

^{2}and equating to zero, we find the maximum likelihood for the value of

*** that minimizes**

*σ* – the minimum of the mean square error (MSE). In addition, this procedure provides the value of *p*^{2}, which satisfies *p*^{2} = *MSE*(** σ***).

The uncertainty in *σ*_{1} and *σ*_{2} is estimated by fitting for each *σ* to a Gaussian:
with the parameter’s uncertainty as its width, and *C* being a constant.

### Estimation results

The estimated model enables prediction of the statistics of crowding events in the ED. **Fig 5**A shows excellent agreement between the model and data with respect to the standard deviation of the number of patients over the week. Furthermore, **Fig 5**B demonstrates that the prediction of the model for the entire patient-number distribution over a given ED shift agrees well with the distribution in the data (the inset shows the cumulative distribution).

(A) The fit of the hourly standard deviation of the number of patients. (B) Semi–logarithmic histogram of the number of patients in the ED in the 10 most crowded weekly shifts (Sunday through Thursday morning and afternoon). The shaded region accounts for the uncertainty in the estimation of the theoretical parameters. The inset shows the cumulative distribution. (C) Semi–logarithmic histogram of the patient hours of a shift relative to the average *x* = *C*_{shift}/〈*C*〉 in the 10 most crowded weekly shifts. The inset shows the cumulative distribution. The *R*^{2} value for (A) is 0.921. The goodness–of–fit for (B) and (C), measured by the Kullback–Leibler divergence, is 0.02 and 0.05 respectively.

Very good agreement with the data is also obtained when computing the distribution function for *relative* crowding, *x* = *C*_{shift}/〈*C*〉, measured in the patient hours during a shift relative to the shift average (**Fig 5**C). For example, the probability to observe relative crowding between 1 and 1.1 (between average and 10% over average) is 24.4%±0.1% in the model compared to 24.0% of the data.

**Table 1** presents the values of the estimated parameters. Interestingly, although we did not fix the noise magnitude *σ*^{1} to the value of 1, to allow for additional sources of noise due to population heterogeneity, the maximum likelihood method estimated *σ*_{1}≃1.1. This value is consistent with the approximation to the master equation by using the Langevin equation, for which *σ*_{1} = 1 (see SI, Appendix A in S1 File) [30]. We confirmed that fixing *σ*_{1} = 1 has a negligible effect on the results; the Kullback-Leibler divergence between the data and model patient-number distribution, as displayed and calculated in **Fig 5**B, changes from 0.02 to 0.029 in this case.

### Estimating overcrowding events

The ability to accurately predict the probability of overcrowding is an important tool for anticipating and exploring mitigation strategies for ED breakdowns. Overcrowding can occur when (i) the number of patients in the ED exceeds a certain absolute threshold, or (ii) when a large relative deviation above the average crowding occurs at a given time. While the absolute numbers indicate the load relative to the existing infrastructures (e.g., beds, physical capacity, staff availability), the relative definition is indicative of the subjective perception of crowding. 20 patients arriving unexpectedly to the ED can cause overcrowding if arriving over the weekend, but can be easily processed during weekdays, when the ED is usually prepared for many arrivals.

We follow the classification of NEDOCS [61], which ranks crowding levels on a scale from 1 to 6, where the top two levels are severe and dangerous overcrowding, which are respectively equivalent in our data to ~120 and ~140 patients. For example, the model’s prediction of the probability of observing dangerous overcrowding (>140 patients) is 0.085%±0.009%, compared to 0.077% in the data, see inset of **Fig 5**B. These probabilities are equivalent to ~7 hours per year. Remarkably, the accuracy of predicting such a rare event, occurring with probability <10^{−3}, is within 10%.

In addition, our model provides excellent predictions for relative overcrowding. For example, the ratio of the probabilities of observing relative overcrowding greater than 40% and 20% is 0.086 in the data, and 0.074±0.01 in the model, within 15% accuracy (see inset of **Fig 5**C).

## Parameter elasticity of crowding

An important contribution of our model lies in its ability to explore the elasticity of crowding to arrival flux and length of stay. A change in the arrival flux *f*(*t*) can potentially occur due to population growth or changes in the medical condition of the population in the surrounding area. While the mean-field description [Eq (2)] indicates that the average number of patients, and the average patient hours depend linearly on the arrival flux *f*(*t*), surprisingly, the probability of observing severe or dangerous overcrowding, *P*(*n*>120), is highly non-linear in *f*(*t*). As shown in **Fig 6**A, while a 10% increment in the arrival flux increases the average number of patients by only 10%, the number of these extreme overcrowding events will increase by a factor of 2.8.

The increment rate of the probability for severe or dangerous overcrowding: the ratio of P(n>n_{s}) to P(n>n_{s}) at zero change, as a function of the change in the (A) arrival flux f(t), (B) typical length of stay and (C) systematic noise magnitude σ_{2}. Here n_{s} = 120 denotes the onset of severe overcrowding. Also, the average length of stay of the data is 3.9 hours, so approximately (depending on the weekday) a change in 10 minutes in the length of stay corresponds to 4%.

A patient’s average length of stay in the ED is given by 1/*β*, and is a metric that could potentially be mitigated by the ED management through better allocation of staff, or more efficient organizational procedures. **Fig 6B** and 6C show the change in the probability of overcrowding as a function of the change in 1/*β* (in minutes), and as a function of the change in *σ*_{2} (the amplitude of systematic noise), respectively. We find that overcrowding in the ED is extremely sensitive to the length of stay; e.g., shortening the typical length of stay by just 20 minutes (7–10% of the typical time, depending upon the day) reduces the number of severe and dangerous overcrowding events by 52% (**Fig 6**B). In addition, we find that the sensitivity to the length of stay is much higher than the sensitivity to systematic noise; e.g., lowering the systematic noise amplitude by 15% decreases the probability of a severe or dangerous overcrowding event by 22% (**Fig 6**C), whereas a similar decrease in this probability can be acquired by lowering the typical length of stay by just 2.5–3% (7 minutes).

Such calculations enable the ED to better allocate investments in various crowding mitigation initiatives. Reducing the typical length of stay (e.g., by addressing process bottlenecks, changing staff allocation, speeding up test results) is, as per our results, more effective in mitigating severe or dangerous overcrowding than reducing the systematic noise (e.g., by investing in maintenance and service contacts for equipment, avoiding fluctuations due to equipment down-time, better allocating critical equipment such as MRI scanners, or by cross functional training of staff to compensate for staff shortage).

## Limitations

This research has several limitations: First, being a stochastic model, this approach cannot predict a specific date of an overcrowding event, but rather, it provides the distribution and probability for such events to occur. Second, this study does not account for several low-frequency phenomena that can be found in the data, such as growth in demand over the years, or annual seasonality and systematic failures which may last several hours or days. Third, the model does not incorporate exogenous catastrophes such as large-scale accidents, extreme weather, or medical staff strikes. Finally, the model does not explicitly incorporate the medical staff size and composition, which may strongly affect the patients’ exit rate. Notably, these factors listed here are not expected to qualitatively change our results, especially those relating to the elasticity to various parameters, and the relative probability to have severe overcrowding. However, incorporating these additional elements into the model may improve the agreement with data with respect to absolute quantities, and more importantly, may provide additional means to mitigate ED overcrowding.

## Conclusion

This paper addresses crowded human environments, which are characterized by high volatility, variation across hours and days, overcrowding events, inter-individual heterogeneity and systematic noise. Modeling crowding in such a way as to account for all of these factors is critical for mitigating overcrowding and preventing service breakdowns.

We present a theoretical framework using stochastic population modeling, an approach that has been applied thus far to describe a broad range of natural phenomena, but not on crowding problems. The model captures the arrival flux, the exit rate, and includes a combination of additive and multiplicative noise. We implemented the model on data from a hospital emergency department, and found that our model provides adequate prediction of the momentary number of patients, the standard deviation and the patient number distribution. Notably, the model accurately predicts the probability of exceeding a certain crowding threshold. More importantly, the model’s main strength lies in its ability to predict how such overcrowding probabilities vary if the model parameters are changed. This ability, absent from various “black-box" models, is an important tool for the mitigation of overcrowding in the ED and the prevention of ED breakdowns.

We used the model to explore several important "what-if" questions: how does population growth affect severe overcrowding in the ED? What happens if the length of stay is shortened by a certain amount? And: What is the effect of changing the systematic noise.

This work is important to both practice and research. ED practitioners can use the model to better allocate resources as per their expected effect. They can predict the volatility and rate of expected overcrowding events of any given magnitude. On the theoretical side, this work demonstrates the power of the stochastic population dynamics formalism, which has been widely used for describing various effects, e.g., in population biology, ecology, epidemiology, chemistry, and statistical physics. We show that this formalism can also be applied to describe the dynamics of populous human environments. The latter, while influenced by numerous variables and characterized by high volatility and overcrowding spikes, can be captured by a compact analytic formulation that enables revealing key underlying mechanisms, and obtaining important insights as to the role of various governing parameters.

This work paves the way for future research in several directions. First, the model can be extended to include the medical staff size as an additional dynamic variable, which can allow computing elasticity to parameters such as the mean staff size and its typical fluctuations. Furthermore, one can study the determinants of other model parameters, such as the dependence of exit rates on the total population in the ED, staff fatigue, medical team composition, etc. Another avenue is to complement the model with other stochastic behaviors, such as low-frequency trends and noises, or an arrival flux with stochastic burst generators mimicking large accidents or other catastrophes. Finally, the model, with these possible generalizations, can be implemented on other populous environments (public transportation, shopping malls, etc.).

## Methods

### Ethics

We used the records as appeared in the ED database (after concealing the patients’ identities). The patients’ identifiers were encrypted by the hospital prior to delivery, so the research team had no access to any information that could identify individual patients during or after data collection. All records relate to visits prior to the beginning of the research. The research project started effectively about 8 months after the date of the last medical record (the data were accessed between Feb 28^{th}, 2019 and Feb 23^{rd}, 2021). Therefore, the patients’ treatment at the ED was not affected by the research. No external intervention was made, no experiments were done, and no questionnaires were distributed. Since this is a retrospective study of medical records and data were analyzed anonymously, no informed consent is required.

The data collection and study were approved by the institutional ERB at Shamir Medical Center, request no. 0028-29-ASF. In writing this paper we followed as closely as possible the STROBE reporting conventions of observational human subject research.

## Supporting information

### S1 File.

Contains the A); Governing Equations for the Stochastic Model. B) Accounting for Colored Noise; C) Alternative Models for the Arrival Flux.

https://doi.org/10.1371/journal.pone.0295130.s001

(DOCX)

## Acknowledgments

We would like to thank Efrat Naor, Michal Elchanan, Noam-Lee Kopivker and Yakov Lacher for their help with the data collection and early analysis. We thank the ED staff of the Shamir Medical center and Dr. Daniel Trotzky, the ED manager, for their invaluable advice and ongoing support. We also thank Ohad Vilk for useful discussions.

## References

- 1.
Eroglu S. A., Machleit K. and Barr T. F., "Perceived retail crowding and shopping satisfaction: the role of shopping values,"
*Journal of Business Research*, vol. 58, p. 1146–1153, 2005. - 2.
Andrews M., Luo X., Fang Z. and Ghose A., "Mobile ad effectiveness: Hyper-contextual targeting with crowdedness,"
*Marketing Science*, vol. 35, p. 218–233, 2016. - 3.
Haase K., Kasper M., Koch M. and Müller S., "A pilgrim scheduling approach to increase safety during the Hajj,"
*Operations Research*, vol. 67, p. 376–406, 2019. - 4.
Ben-Yakov M., Kapral M. K., Fang J., Li S., Vermeulen M. J. and Schull M. J., "The association between emergency department crowding and the disposition of patients with transient ischemic attack or minor stroke,"
*Academic Emergency Medicine*, vol. 22, p. 1145–1154, 2015. pmid:26398233 - 5.
Berry Jaeker J. A. and Tucker A. L., "Past the point of speeding up: The negative effects of workload saturation on efficiency and patient severity,"
*Management Science*, vol. 63, p. 1042–1062, 2017. - 6.
Asaro P. V., Lewis L. M. and Boxerman S. B., "Emergency department overcrowding: analysis of the factors of renege rate,"
*Academic Emergency Medicine*, vol. 14, p. 157–162, 2007. pmid:17185293 - 7.
Asaro P. V., Lewis L. M. and Boxerman S. B., "The impact of input and output factors on emergency department throughput,"
*Academic Emergency Medicine*, vol. 14, p. 235–242, 2007. pmid:17284466 - 8.
Trotzky D., Tsur A. M., Fordham D. E., Halpern P., Ironi A., Ziv-Baran T., et al, "Medical expertise as a critical influencing factor on the length of stay in the ED: A retrospective cohort study,"
*Medicine*, vol. 100, 2021. pmid:34106655 - 9.
Cha W. C., Do Shin S., Cho J. S., Song K. J., Singer A. J. and Kwak Y. H., "The association between crowding and mortality in admitted pediatric patients from mixed adult-pediatric emergency departments in Korea,"
*Pediatric Emergency Care*, vol. 27, p. 1136–1141, 2011. pmid:22134231 - 10.
Kadri F., Harrou F., Chaabane S. and Tahon C., "Time series modelling and forecasting of emergency department overcrowding,"
*Journal of Medical Systems*, vol. 38, p. 1–20, 2014. - 11.
Wartelle A., Mourad-Chehade F., Yalaoui F., Laplanche D. and Sanchez S., "Analysis of Saturation in the Emergency Department: A Data-Driven Queuing Model Using Machine Learning," in
*Challenges of Trustable AI and Added-Value on Health*, IOS Press, 2022, p. 88–92. - 12.
Green L. V., Soares J., Giglio J. F. and Green R. A., "Using queueing theory to increase the effectiveness of emergency department provider staffing,"
*Academic Emergency Medicine*, vol. 13, p. 61–68, 2006. pmid:16365329 - 13.
Daldoul D., Nouaouri I., Bouchriha H. and Allaoui H., "A stochastic model to minimize patient waiting time in an emergency department,"
*Operations Research for Health Care*, vol. 18, p. 16–25, 2018. - 14.
Gao Z., Qu Y., Li X., Long J. and Huang H.-J., "Simulating the dynamic escape process in large public places,"
*Operations Research*, vol. 62, p. 1344–1357, 2014. - 15.
Benbelkacem S., Kadri F., Atmani B. and Chaabane S., "Machine learning for emergency department management,"
*International Journal of Information Systems in the Service Sector (IJISSS)*, vol. 11, p. 19–36, 2019. - 16.
Chan C. W., Farias V. F., Bambos N. and Escobar G. J., "Optimizing intensive care unit discharge decisions with patient readmissions,"
*Operations research*, vol. 60, p. 1323–1341, 2012. - 17.
Jagtenberg C. J., Bhulai S. and van der Mei R. D., "An efficient heuristic for real-time ambulance redeployment,"
*Operations Research for Health Care*, vol. 4, p. 27–35, 2015. - 18.
Kuo Y.-H., Rado O., Lupia B., Leung J. M. Y. and Graham C. A., "Improving the efficiency of a hospital emergency department: a simulation study with indirectly imputed service-time distributions,"
*Flexible Services and Manufacturing Journal*, vol. 28, p. 120–147, 2016. - 19.
Kuo Y.-H., Chan N. B., Leung J. M. Y., Meng H., So A. M.-C., Tsoi K. K. F. et al, "An integrated approach of machine learning and systems thinking for waiting time prediction in an emergency department,"
*International journal of medical informatics*, vol. 139, p. 104143, 2020. pmid:32330853 - 20.
Ho A. F. W., To B. Z. Y. S., Koh J. M. and Cheong K. H., "Forecasting hospital emergency department patient volume using internet search data,"
*IEEE Access*, vol. 7, p. 93387–93395, 2019. - 21.
Zhao X., Li K., Ang C. K. E., Ho A. F. W., Liu N., Ong M. E. H. et al, "A deep learning architecture for forecasting daily emergency department visits with acuity levels,"
*Chaos*,*Solitons & Fractals*, vol. 165, p. 112777, 2022. - 22.
Hoot N. R., LeBlanc L. J., Jones I., Levin S. R., Zhou C., Gadd C. S. et al, "Forecasting emergency department crowding: a discrete event simulation,"
*Annals of Emergency medicine*, vol. 52, p. 116–125, 2008. pmid:18387699 - 23.
Cats O., West J. and Eliasson J., "A dynamic stochastic model for evaluating congestion and crowding effects in transit systems,"
*Transportation Research Part B*:*Methodological*, vol. 89, p. 43–57, 2016. - 24.
Lachapelle A. and Wolfram M.-T., "On a mean field game approach modeling congestion and aversion in pedestrian crowds,"
*Transportation Research part B*:*methodological*, vol. 45, p. 1572–1589, 2011. - 25.
Sinreich D. and Marmor Y., "Emergency department operations: the basis for developing a simulation tool,"
*IIE transactions*, vol. 37, p. 233–245, 2005. - 26.
Abo-Hamad W. and Arisha A., "Simulation-based framework to improve patient experience in an emergency department,"
*European journal of operational research*, vol. 224, p. 154–166, 2013. - 27.
Vanbrabant L., Braekers K., Ramaekers K. and Van Nieuwenhuyse I., "Simulation of emergency department operations: A comprehensive review of KPIs and operational improvements,"
*Computers & Industrial Engineering*, vol. 131, p. 356–381, 2019. - 28.
Barak-Corren Y., Chaudhari P., Perniciaro J., Waltzman M., Fine A. M. and Reis B. Y., "Prediction across healthcare settings: a case study in predicting emergency department disposition,"
*npj Digital Medicine*, vol. 4, p. 169, 2021. pmid:34912043 - 29.
Xie F., Zhou J., Lee J. W., Tan M., Li S., Rajnthern L. S., et al, "Benchmarking emergency department prediction models with machine learning and public electronic health records,"
*Scientific Data*, vol. 9, p. 658, 2022. pmid:36302776 - 30.
Assaf M. and Meerson B., "WKB theory of large deviations in stochastic populations,"
*Journal of Physics A*:*Mathematical and Theoretical*, vol. 50, p. 263001, 2017. - 31.
Gardiner C. W., Handbook of stochastic methods for physics, chemistry and the natural sciences, Second ed., vol. 13, Haken H., Ed., Berlin: Springer-Verlag, 1985.
- 32.
Maltby L., Kedwards T. J., Forbes V. E., Grasman K., Kammenga J. E., Munns W. R. Jr, et al, "Linking individual-level responses and population-level consequences,"
*Ecological variability*:*Separating natural from anthropogenic causes of ecosystem impairment*, p. 27–82, 2001. - 33.
Ovaskainen O. and Meerson B., "Stochastic models of population extinction,"
*Trends in Ecology & Evolution*, vol. 25, p. 643–652, 2010. pmid:20810188 - 34.
Leirs H., Stenseth N. C., Nichols J. D., Hines J. E., Verhagen R. and Verheyen W., "Stochastic seasonality and nonlinear density-dependent factors regulate population size in an African rodent,"
*Nature*, vol. 389, p. 176–180, 1997. pmid:9296494 - 35.
McKane A. J. and Newman T. J., "Stochastic models in population biology and their deterministic analogs,"
*Physical Review E*, vol. 70, p. 041902, 2004. pmid:15600430 - 36.
Allen L. J. S. and Allen E. J., "A comparison of three different stochastic population models with regard to persistence time,"
*Theoretical Population Biology*, vol. 64, p. 439–449, 2003. pmid:14630481 - 37. Mode C. J. and Sleeman C. K., Stochastic processes in epidemiology: HIV/AIDS, other infectious diseases and computers, Singapore: World Scientific, 2000.
- 38.
Chen W.-Y. and Bokka S., "Stochastic modeling of nonlinear epidemiology,"
*Journal of Theoretical Biology*, vol. 234, p. 455–470, 2005. pmid:15808867 - 39.
Elowitz M. B., Levine A. J., Siggia E. D. and Swain P. S., "Stochastic gene expression in a single cell,"
*Science*, vol. 297, p. 1183–1186, 2002. pmid:12183631 - 40.
Kaern M., Elston T. C., Blake W. J. and Collins J. J., "Stochasticity in gene expression: from theories to phenotypes,"
*Nature Reviews Genetics*, vol. 6, p. 451–464, 2005. pmid:15883588 - 41.
Singh A. and Soltani M., "Quantifying intrinsic and extrinsic variability in stochastic gene expression models,"
*Plos One*, vol. 8, p. e84301, 2013. pmid:24391934 - 42.
Paulsson J., "Models of stochastic gene expression,"
*Physics of life reviews*, vol. 2, p. 157–175, 2005. - 43.
Wilkinson D. J., "Stochastic modelling for quantitative description of heterogeneous biological systems,"
*Nature Reviews Genetics*, vol. 10, p. 122–133, 2009. pmid:19139763 - 44.
Assaf M., Roberts E. and Luthey-Schulten Z., "Determining the stability of genetic switches: explicitly accounting for mRNA noise,"
*Physical review letters*, vol. 106, p. 248102, 2011. pmid:21770603 - 45.
Assaf M. and Meerson B., "Extinction of metastable stochastic populations,"
*Physical Review E*, vol. 81, p. 021116, 2010. pmid:20365539 - 46.
Brown E. and Ahlers G., "Large-scale circulation model for turbulent Rayleigh-Bénard convection,"
*Physical Review Letters*, vol. 98, p. 134501, 2007. - 47.
Assaf M., Angheluta L. and Goldenfeld N., "Rare fluctuations and large-scale circulation cessations in turbulent convection,"
*Physical Review Letters*, vol. 107, p. 044502, 2011. pmid:21867011 - 48.
Shih H.-Y., Hsieh T.-L. and Goldenfeld N., "Ecological collapse and the emergence of travelling waves at the onset of shear turbulence,"
*Nature Physics*, vol. 12, p. 245–248, 2016. - 49.
*Global Campaign Against ED Over-Crowding*, 2022. - 50.
Schneider S. M., Gallery M. E., Schafermeyer R. and Zwemer F. L., "Emergency department crowding: a point in time,"
*Annals of emergency medicine*, vol. 42, p. 167–172, 2003. pmid:12883503 - 51.
Bond K., Ospina M., Blitz S., Afilalo M., Campbell S., Bullard M., et al, "Frequency, determinants and impact of overcrowding,"
*Healthcare Quarterly*, vol. 10, p. 32–40, 2007. - 52.
Pitts S. R., Pines J. M., Handrigan M. T. and Kellermann A. L, "National trends in emergency department occupancy, 2001 to 2008: effect of inpatient admissions versus emergency department practice intensity,"
*Annals of emergency medicine*, vol. 60, p. 679–686, 2012. pmid:22727201 - 53.
Derlet R. W., Richards J. R. and Kravitz R. L., "Frequent overcrowding in US emergency departments,"
*Academic Emergency Medicine*, vol. 8, p. 151–155, 2001. - 54.
Tekwani K. L., Kerem Y., Mistry C. D., Sayger B. M. and Kulstad E. B., "Emergency department crowding is associated with reduced satisfaction scores in patients discharged from the emergency department,"
*Western Journal of Emergency Medicine*, vol. 14, p. 11, 2013. pmid:23447751 - 55.
Abidova A., da Silva P. A. and Moreira S., "Understanding Complaints in the Emergency Department,"
*Health Services Insights*, vol. 14, p. 11786329211057351, 2021. pmid:34898988 - 56.
*American College of Emergency Physicians—Policy Statement—Crowding*, 2019. - 57.
Trzeciak S. and Rivers E. P., "Emergency department overcrowding in the United States: an emerging threat to patient safety and public health,"
*Emergency medicine journal*, vol. 20, p. 402–405, 2003. pmid:12954674 - 58.
Morley C., Unwin M., Peterson G. M., Stankovich J. and Kinsman L., "Emergency department crowding: a systematic review of causes, consequences and solutions,"
*PloS one*, vol. 13, p. e0203316, 2018. pmid:30161242 - 59.
Batt R. J. and Terwiesch C., "Waiting patiently: An empirical study of queue abandonment in an emergency department,"
*Management Science*, vol. 61, p. 39–59, 2015. - 60.
Medley D. B., Morris J. E., Stone C. K., Song J., Delmas T. and Thakrar K., "An association between occupancy rates in the emergency department and rates of violence toward staff,"
*The Journal of emergency medicine*, vol. 43, p. 736–744, 2012. pmid:22325552 - 61.
Weiss S. J., Derlet R., Arndahl J., Ernst A. A., Richards J., Fernández-Frankelton M., et al, "Estimating the degree of emergency department overcrowding in academic medical centers: results of the National ED Overcrowding Study (NEDOCS),"
*Academic emergency medicine*, vol. 11, p. 38–50, 2004. pmid:14709427 - 62.
Lande R., Engen S., Saether B.-E. et al, Stochastic population dynamics in ecology and conservation, Oxford University Press on Demand, 2003.
- 63.
Kleinrock L., "Time-shared systems: A theoretical treatment,"
*Journal of the ACM (JACM)*, vol. 14, p. 242–261, 1967. - 64.
Hwang U. and Concato J., "Care in the emergency department: how crowded is overcrowded?,"
*Academic Emergency Medicine*, vol. 11, p. 1097–1101, 2004. pmid:15466155 - 65.
Bellow A. A. and Gillespie G. L., "The evolution of ED crowding,"
*Journal of Emergency Nursing*, vol. 40, p. 153–160, 2014. pmid:23481863