While this approach might help us produce rough estimates for staffing needs, though, it does not provide a great predictor in the context of emergent events (say if a large number of car accident victims come in at the same time, requiring immediate care—thus, increasing the wait time of the entire waiting room). Furthermore, the optimal length of the time window to take into account will vary by hospital. One oft-used approach is to vary the time window and then choose the optimal model by minimizing the Mean Square Error (MSE). These estimates can be improved even further, though, by separating out high acuity patients, so as not to subsequently underestimate low acuity patient wait times.

Additionally, in some contexts, researchers have found that univariate measures like rolling averages can be improved by introducing the results of multiple variables into the model, via more complex vector autoregression models. For instance, laboratory, radiography, and CT volumes all play a role in impending wait times, as does patient arrival count. Models that take all these different variables into account have been shown to more accurately predict wait times in certain contexts, but they have not been widely validated.

Predicting Wait Time through Simulation

Another common way to make predictions about wait times is to pursue a simulation-based approach. One of the many advantages of this approach to prediction is that it allows researchers to assess how varying hospital staffing, numbers of patients, or any number of factors works to produce different wait times. Furthermore, real-time simulations based on current resources have been shown to perform better (i.e. exceed the R-squared score of ~.40) than more conventional methods like rolling average predictions for short-term/emergent predictions.

This type of discrete event simulation can be effectively done using Python’s SimPy library. While the code for such a simulation is a bit too involved for this post (see here, for a simplified version of the code), consider a bird’s eye view of the process:

1. Identify the amount of staffing at the hospital, as well as the number of patients waiting.

2. Produce a probability distribution estimate of how long it takes for staff to see a patient. This distribution may be a simple triangular distribution (composed of the minimum time, mode time, and maximum time, for instance), or a more complex empirically derived distribution.

3. Start the simulation by introducing patients into the process and measuring the length of time it takes for them to be seen.

SimPy then has built-in tools for plotting the simulation results like so:

From SimPy Bank Tutorial Plotting Example
From SimPy Bank Tutorial Plotting Example


Thus, if we know that there are a certain number of patients and a certain amount of staff, wait times can be computed in real-time by this method. It is simply a matter of regularly updating the simulation to reflect the current conditions of the hospital. So, when you as a patient walk in, it is possible to simulate how long you will have to wait based entirely on the conditions at hand and the assumptions of the simulation.

While simulation methods show diminishing returns for predicting wait times further into the future (with their R-squared values sometimes dipping below the R-squared of ~.40 value obtained by Rolling Averages for greater the 6 hours in the future), as real-time tools to alleviate patient anxiety, they have a lot of potential.

Furthermore, at a planning level, simulation methods make it possible to judge trade-offs in wait time and staffing. For instance, Laskowski et al. found that while increasing doctors improved wait times, both in terms of stability and relative size, the effects plateau in the 3 to 4 doctor range for the range of scenarios they explored (2009):

From Lascowski et al. 2009 , Figure 5
From Lascowski et al. 2009, Figure 5


Thus, for this particular simulation scenario, we would not want to maximize our doctors, but produce a stable wait time by bringing in 3-4 doctors. To fully optimize for limited hospital resources, researchers have suggested machine learning techniques such as genetic algorithms, for identifying a perfect combination of staffing and patient wait times for a given scenario. Remember, though, that these simulations tend to work best for short-term prediction, and thus are not always reliable far into the future. However, such an approach could be useful for planning hospital responses/staffing to mass disasters or other events that will not be reflected in the long-term time series-based predictions.


In summary, both simulation and time series analysis techniques have been shown to have success in predicting hospital wait times. While neither approach is a silver bullet, in combination they can be used to effectively assess both longer-term patterns (in the case of standard time series methods) and immediate, real-time developments (in the case of simulation approaches). The hope is that as these methods are adopted, we will see less anxious patients and more efficiently staffed hospitals.