Advanced Forecasting Techniques: How To Use Advanced Forecasting Techniques For Estimating Demand of NHS Services
Advanced Forecasting Techniques: How To Use Advanced Forecasting Techniques For Estimating Demand of NHS Services
techniques
How to use advanced forecasting techniques for estimating demand of
NHS services
1 | Contents
Introduction
This document will provide an overview of some advanced forecasting techniques
that can be used as part of demand and capacity modelling for NHS services. It will
also review the basic forecasting steps, how to choose and evaluate a method,
links to the current suite of demand and capacity models, and software packages
which can carry out these techniques, including both open-source and licensed
products.
This document will not provide an in-depth tutorial on forecasting methods. If you
are interested in learning about these methods in more detail, we recommend the
online book Forecasting: Principles and Practice1. This is a freely available online
textbook that goes through the main forecasting techniques in detail and is a good
introduction to the topic. It is based in R (an open-source statistical program) and
includes a full set of exercises and example datasets.
2 | Introduction
Estimating demand for
NHS services using
advanced forecasting
techniques
Accurate forecasting of demand is an important part of demand and capacity
modelling. In many cases, a simple approach (e.g. ‘next year will be similar to last
year’) will work well enough for planning purposes, and this is the approach used in
the suite of tools developed by the National Demand and Capacity Programme for
elective care.
There are services, with more complex and unstable patterns of demand, where
this simple approach will not work, and more advanced forecasting techniques are
needed to better predict future demand. For instance, in an A&E setting, demand
figures differ drastically between seasons, days of the week, and time of the day. It
is also reasonable to assume that some aspects of the past patterns will continue
into the future.
For these complex and unstable services, advanced forecasting techniques are
needed to make a good estimation of future demand. These techniques improve
the quality of forecasts, as they will account for additional factors such as significant
variation, seasonality and historic growth trends which are not accounted for in the
existing model suite.
Advanced forecasting techniques are commonly used in other industries but require
specialist knowledge and training to use effectively. Therefore, this document
1. Problem
definition
5. Using and
evaluating a 2. Collecting
forecasting information
method
4. Choosing
3. Initial data
and fitting
analisys
methods
1. Problem definition: Understanding what the forecasting will be used for, who
requires the forecasting, and how it fits in with the organisation. This step is
perhaps the most important and not always a simple one.
3. Initial data analysis: Before you begin to model or forecast a given time series,
an initial analysis of the data should be carried out, giving particular attention to the
Initial data analysis should also evaluate whether the time series is stationary (i.e., if
basic statistical properties such as the mean and variance of the series remain
constant through time). Most time series methods are based on the assumption that
the data is stationary; if the time series is non-stationary, one or more data
transformations may be necessary to make the time series stationary before further
analysis can take place2.
4. Choosing and fitting methods: the choice of method will depend on the
question that is being asked, the available data, and the relationship between the
variable and the explanatory variables.
Once a suitable method has been chosen, we then need to fit the model. This is
carried out by adjusting the model parameters, so they replicate historical data.
5. Using and evaluating a forecasting method: the model can be evaluated when
the data for the forecast period becomes available. The model forecasts and the
real observations are measured and the error between the two are estimated. More
detail on how to evaluate the accuracy of a model is provided later in this
document.
1 Autocorrelation refers to how correlated a time series is with its past values. An
autocorrelation function (ACF) plot can be used to identify the strength and time offset of
these autocorrelations.
2
Some techniques that can be used to help with this analysis can be found here:
https://otexts.com/fpp2/graphics.html and https://otexts.com/fpp2/decomposition.html
ARIMA modelling has four stages: before starting, the time series needs to be
differenced until it is stationary. Its Autocorrelation (ACF) and Partial Autocorrelation
Functions (PACF)4 are compared with ones from various theoretical time-series to
estimate the order of the process. Second, the parameters of the model are
estimated. Third, the residuals are examined to see if the model is adequate.
Finally, alternative models are considered.
SARIMA
Seasonal autoregressive integrated moving average (SARIMA) models extend
basic ARIMA models and allow for the incorporation of a repetitive pattern, such as
the weekly pattern observed in daily ED patient volumes.
When working with time series data that display seasonal patterns, it is important to
not only identify the correlation between current observations and their immediate
predecessors, but also to determine whether correlation exists between current
observations and their predecessors from previous seasons. This is referred to as
evaluating the time series at both the nonseasonal and seasonal levels.
Exponential Smoothing
Exponential smoothing is a term that is applied to a variety of methods that
generate forecast‐based formula that weight recent observations more heavily than
more remote observations (based on weighted moving average formula).
Exponential smoothing techniques include parameters for estimating the level (ie.
mean), trend, and seasonality of a dataset, which can be used for forecasting.
Prophet
Facebook released a package implementing a Bayesian forecasting approach. This
method recognizes repeating patterns over weeks, months, years, and identified
holidays. Prophet is set up as an automated process and can be installed as a
4
Partial autocorrelation is the autocorrelation that results after removing the effects of any
autocorrelations due to terms at shorter lags.
Further advantages include the ability to train from a moderate sized dataset,
without the need for specialist commercial software, and fast start up times for
development5. While more advanced models are developed, time-series–based
prediction offers the possibility of improving analytical capability in the short term.
However, an important principle of forecasting in general is that these tools are best
applied thoughtfully, with consideration of their strengths and limitations.
Tuning parameters can help to optimize the outputs of the models. If optimizing
Prophet outputs is of interest, information regarding it is available online6.
TBATS
The names are acronyms for key features of the models: Trigonometric seasonality,
Box-Cox transformation, ARIMA errors, Trend and Seasonal components. In
essence, TBATS evaluates multiple forecasting techniques against a training
dataset, and picks the ‘best’ method based on some key metrics (this is discussed
in more detail later in the document).
5 https://jamanetwork.com/journals/jamanetworkopen/fullarticle/2712176 and
https://kourentzes.com/forecasting/2017/07/29/benchmarking-facebooks-prophet/
6
https://towardsdatascience.com/implementing-facebook-prophet-efficiently-c241305405a3
10 | Choosing a method
Easily interpretable results. Multiple variables, which requires
additional data collection and
parameter estimation.
Informative modelling process.
Statistical software widely
available.
Consistently provided more
accurate forecasts of daily ED
patient volumes than the linear
regression models.
Prophet Fully automated routine - Often requires tuning the
recognizes repeating patterns parameters to get a more
over weeks, months, years, and accurate estimation.
identified holidays.
Simple syntax allows you to Can take a long time to run for
generate results with a single moderate sized datasets in R –
command. could be problematic if you need
to run this across multiple
datasets.
Available in R and Python.
11 | Choosing a method
Evaluating the methods
When evaluating forecasting methods, there is no general ‘best’ method. Typically,
we seek to find the method that has the least ‘error’ (ie. difference between
predicted and actual value) overall. There are a number of error indicators which
can be used to assess a model.
MAPE is the most commonly used technique. We will look at MAPE and the Akaike
Information Criterion (AIC), which is another method of evaluating statistical models
that is used, especially for techniques that use a combination of methods.
MAPE
The model with the lowest AIC score will be selected as the final method.
We have highlighted here two common, and freely available packages which are
commonly used for data science.
Python
Python is a programming language known for its relatively simple syntax and vast
library of available modules and packages which can be used by relatively novice
users to achieve results quickly. Full information on the Python programming
language can be found online.
There is a vast array of information and tutorials available online for completing time
series forecasting in Python, with one example given below. 9 Depending on the
packages and datasets used, there may be slight improvements in the speed of
data analysis compared to R.
8 https://otexts.com/fpp2/appendix-using-r.html
9https://towardsdatascience.com/an-end-to-end-project-on-time-series-analysis-and-forecasting-
with-python-4835e6bf050b
14 | Available software
Link to Demand and
Capacity models
Jones, S.A., Joy, M.P. & Pearson, J. Health Care Management Science (2002)
5: 297. https://doi.org/10.1023/A:1020390425029
Kasapoglu OA. Selection of the Forecasting Model in Health Care. J Hosp Med
Manage. 2016, 2:2. https://hospital-medical-management.imedpub.com/selection-
of-the-forecasting-model-in-health-care.pdf
Spencer, J., Alun, T. & others. Forecasting Daily Patient Volumes in the Emergency
Deparment. Academic Emergency Medicine. February 2008. Vol 15 N. 2.
https://onlinelibrary.wiley.com/doi/full/10.1111/j.1553-2712.2007.00032.x
16 | References