Predicting Hospital Wait Times

An increasingly prominent area of prediction in recent years has been the modeling of wait times in hospitals. Having accurate wait time predictions has been shown to be psychologically beneficial to patients if they are publicly visible, making people more likely to wait for the care they need. In addition, hospital staffing costs upwards of 50% of overall hospital costs. Thus, there is always a financial balancing act for the hospital: overstaffing the hospital means losing money, whereas understaffing might prohibit meeting patient needs and lead to exorbitant wait times. Ideal staffing – optimal use of funds – is the constant goal.

Therefore, both from the perspective of patients and hospitals there is a general need to be able to predict wait times, whether for psychological benefits or schedule optimization needs. In this post, we will explore some of the main ways that officials predict hospital wait times and assess how successful they are at doing so.

Methods for Predicting Hospital Wait Time

Part of what makes hospital wait times difficult to predict is that they depend on so many different variables. For instance, consider that when there are more patients than hospital staff, there will naturally be higher wait times than when the opposite is true. Different times of days will exacerbate or ease this effect.

In addition, not all patients are treated equally by the hospital itself. For example, “high acuity” patients – those who arrive in an ambulance, gurney, or under custody of law-enforcement – are likely to be treated more quickly than “low acuity” patients who are able to walk in on their own accord. Taking all of these variables into account, consider how they vary by time and relate to one another in the San Mateo Medical Center Data from 2012-2013:

Emergency Department Average Data by Time of Day from San Mateo Medical Center (June 2012-October 2013) from  Ang, et al. 2015: 8

Emergency Department Average Data by Time of Day from San Mateo Medical Center (June 2012-October 2013) from Ang, et al. 2015: 8

Given all these interacting factors, how do we go about predicting wait times, though? Researchers have pursued two main approaches to this question: time series analysis and simulation. For the remainder of this post, we’ll explore how these two different approaches have been used to predict hospital wait times.

Time Series Forecasting for Hospital Wait Time:

In many cases, simple rolling average models have been found to outperform other, more complicated methods of modeling in predicting wait times in terms of their R-squared score (all in the .40 range). As a the name suggests, Rolling Average models work by moving over set time-windows (i.e. an hour, a minute, ten minutes, etc.) and averaging the set of values within each window to model a time series. One advantage of these approaches is that they are often highly accessible right out of the box.

Python’s Pandas package, for instance, provides a useful implementation such that you can input time series data and fit a rolling average model in a single line of code. For instance, consider a hospital’s hourly average time to treatment (in minutes) for the previous day:

import pandas as pd
hourly_time_to_treatment = [80, 70, 75, 51, 43, 64, 80, 80, 90, 92, 100, 101, 90, 85, 79, 81, 85, 91, 87, 85, 89, 88, 85, 81]
times = pd.date_range('2017-03-01', periods=24, freq='60min')
hourly_wait_time_df = pd.DataFrame(hourly_time_to_treatment, index=times)

If we wanted to predict tomorrow’s time to treatment using a rolling averages method, we might take averages every 4 hours, to produce predictions, where predictions are in red:

rolling_avg = hourly_wait_time_df.rolling(window=4).mean()
plt.plot(hourly_wait_time_df); plt.xlabel('Hour'); plt.ylabel('Average Time to Treatment')
plt.plot(rolling_avg, color = ‘red’)

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 came 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 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) of 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 a 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:

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.