Issue 34 Summer 2014 THE INTERNATIONAL JOURNAL OF APPLIED FORECASTING THE INTERNATIONAL JOURNAL OF APPLIED FORECASTING
5 Special Feature: Forecasting by Aggregation 19 Fortune Tellers and Forward Thinkers 32 Forecasting for Revenue Management 39 Relative Error Metrics for Supply Chain Forecasts
Improving Forecasting via Multiple Temporal Aggregation Fotios Petropoulos and Nikolaos Kourentzes
Preview In most business forecasting applications, the decision-making need we have directs the frequency of the data we collect (monthly, weekly, etc.) and use for forecasting. In this article, Fotios and Nikolaos introduce an approach that combines forecasts generated by modeling the different frequencies (levels of temporal aggregation). Their technique augments our information about the data used for forecasting and, as such, can result in more accurate forecasts. It also automatically reconciles the forecasts at different levels.
S
LET’S GET STARTED
hort-term operational forecasts typically utilize monthly, weekly, or even daily data. For long-term forecasts, on the other hand, the common suggestion is to use quarterly and annual data, as these frequencies most often provide smoother historical patterns and thus a better view of long-term behaviour (although they do not offer all the detail needed for short-term forecasting). One problem is that forecasts produced from different frequencies are virtually certain to be different. In the absence of some reconciliation, the cumulative short-term forecasts obtained from the weekly or monthly data will diverge from the long-term forecasts derived from the quarterly or annual data. Secondly, we often find that the same models are applied to produce both the short- and long-term forecasts, a simplification with disadvantages for long-horizon forecasting. Different frequencies of the data reveal or conceal various time-series features. When fast-moving time series are considered, random variations and seasonal patterns are more apparent in the daily, weekly, or
Figure 1. A Monthly Fast-Moving Time Series at Different Levels of Temporal Aggregation
12 FORESIGHT Summer 2014
monthly data. We use the term level of temporal aggregation to refer to the size of the time buckets. Using nonoverlapping temporal aggregation makes it easy to construct lower-frequency series (such as quarterly or annual) from higher-frequency series (such as weekly or monthly). This process acts as a filter, smoothing the high-frequency features and providing a better approximation of the long-term components of the data, such as level, trend, and cycle. In Figure 1, notice how the series changes for various levels of aggregation. The original monthly series is dominated by the seasonal component, while the 12th level of aggregation, the annual series, is dominated by a shift in the level and a weak trend. In the case of intermittent-demand data, moving from higher (monthly) to lower (yearly) frequency data reduces or even removes the intermittence of the data, minimizing the number of periods with zero demands. This is beneficial in that, in the absence of the zeroes, conventional forecasting methods become applicable to the problem. Figure 2 demonstrates the changing pattern of an intermittent series as the level of the temporal aggregation changes. Such time-series features, both for fast- and slow-moving items, affect forecasting accuracy. The question, then, for the practicing forecaster is: “Which aggregation level of my data should I use?”
DON’T TRUST YOUR DATA (OR YOUR MODELS)! As the time-series features change with the frequency of the data (or the level of aggregation), different methods will be identified as optimal. These will produce different forecasts, which will ultimately lead to different decisions. Following Box and Draper’s famous quote that “all models are wrong, but some are useful,” a potential answer to the question of which aggregation level of the data should be selected is to try to make the most of your data! We can do so by using multiple aggregation levels (i.e., multiple frequencies). We would model each frequency (monthly, quarterly, etc.) separately, capturing the particular features of that data. We could then combine the models or their forecasts into a robust final forecast, one that will encompass information from all the frequencies. So rather than trust a model from a single aggregation level, consider multiple aggregation levels. This strategy means we do not focus on the forecasts of a single model, thus reducing the risk of selecting a bad model, and mitigating the importance of model selection.
THE HOW-TO In this section, we explain how our multiple aggregation prediction algorithm (MAPA, Kourentzes and colleagues, 2014) should be applied in practice. MAPA works in three steps: aggregate, forecast, and combine, as Figure 3 illustrates.
Step 1: Aggregation In the standard approach, the input to the statistical forecast methods is a single frequency of the data, which reflects the data
Key Points ■ Multiple temporal aggregation can aid the identification of the characteristics of our data histories, as we see the data across different frequencies (day, week, month, etc.). As the various components of the series are better captured, we can expect substantial improvements in forecasting performance, especially for longer horizons. ■ C ombining forecasts across different levels of aggregation leads to estimates that are reconciled across frequencies and thus provide consistent forecasts over operational, tactical, and strategic horizons. ■ The essential idea is to forecast each frequency from most granular (e.g. daily) to the most aggregate (say, monthly), and then to appropriately combine the forecasts made from the different frequencies. ■ Commercial forecasting software does not provide adequate functionality for temporal aggregation. We offer here our multiple aggregation prediction algorithm (MAPA) that can be implemented in the open-source statistical software package R and provides a template for commercial software implementation.
collection process and intended use of the forecasts. In contrast, MAPA employs multiple instances of the same data, which correspond to the different aggregation levels. Suppose we have collected 4 years of monthly observations (48 data points). These can be aggregated to quarterly data (1 quarter = 3 months), for which we’d have 48/3 = 16
Figure 2. A Monthly Slow-Moving Time Series at Different Levels of Temporal Aggregation
www.forecasters.org/foresight FORESIGHT
13
Figure 3. The Standard vs. the MAPA Approach
time buckets. In this case, the temporal aggregation level is equal to 3 periods, while the transformed frequency is equal to 1/3 of the original. This process of aggregating the original data can continue so long as all transformed series have enough time buckets left to produce statistical forecasts. If the original data are monthly, and given that companies usually hold 3 to 5 years of history, we suggest that the aggregation process continues up to the yearly frequency (aggregation level = 12 periods). We propose that the upper level of aggregation should reach at least the annual level, where seasonality is filtered completely from the data and long-term (low-frequency) components, such as trend, dominate. Of course, the set of aggregation levels should contain the levels most relevant to the intended use of the forecasts: for example, monthly forecasts for S&OP or yearly forecasts for long-term planning. This ensures that the resulting MAPA forecast captures all relevant time-series features and therefore provides temporally reconciled forecasts. The output of this first step is a set of series, all corresponding to the same base data but translated to different frequencies.
Step 2: Forecasting Each and every one of the aggregate series calculated in Step 1 should be forecast separately. Assuming you apply the automatic model selection protocol in your forecasting software, it is very likely that a different model will be selected for each aggregation
14 FORESIGHT Summer 2014
level. Seasonal models, for example, are most likely to be selected at lower aggregation levels (such as monthly), while the longterm trend will be better captured in yearly data. In the case of intermittent demand series, there are classification schemes that allow you to choose between widely used forecasting methods such as Croston’s method and the Syntetos-Boylan Approximation (SBA) (Syntetos and colleagues, 2005; Kostenko & Hyndman, 2006). Under such schemes, the levels of intermittency and the variability of the demand distinguish which method is more appropriate. Using multiple aggregation levels will change both the intermittence and the variability, so we expect that different methods will be identified as best. Further, at higher levels of aggregation the resulting series may no longer contain zero demand periods, which opens the door to many conventional model selections. It also may be that the aggregation of the original data reveals regular time-series components (such as trend or seasonality) that may not exist at the lower levels of granularity. The result of this step are multiple forecasts, each corresponding to a particular frequency of the data.
Step 3: Combination This final stage of the MAPA approach is the combination of the different forecasts. However, before the forecasts can be combined, they must be transformed back to the original frequency. While such disaggregation can be done in several ways (Nikolopoulos and colleagues, 2011), it can be effective to simply divide an aggregate forecast into equal parts at the more granular levels. Assume, for example, that we have forecasts at the quarterly level, and need to transform these to the original monthly frequency. We could simply divide each quarterly forecast by 3 and input the same value for each of the 3 months. Once all forecasts from the various aggregation levels are translated back to the original frequency, they are ready to be combined (i.e., averaged) into a final forecast. The average used can be a mean, median, or other operator such as the trimmed mean. We have
Figure 4. MAPA Forecasts for the Intermittent Demand Data
THE CASE OF SEASONALITY found that both mean and median perform well, although the latter is more appropriate to ensure that the combined final forecasts are not affected by extreme values. The intended use of the final forecast may well require a different frequency from the original data (e.g. quarterly rather than monthly), and different aggregation levels are apt to be needed for operational, tactical, and strategic planning. To achieve the desired frequencies, we can aggregate the final forecast to the desired frequencies. Since the MAPA forecasts are derived from information from all levels of aggregation, they are already temporally reconciled. There is no longer a need to work out how to ensure that the forecasts agree.
ILLUSTRATIVE CALCULATIONS
Figure 4 illustrates the MAPA forecast for the intermittent data of Figure 2. • I n step 1, the monthly series (called Level 1) is aggregated into quarterly (Level 3), half-yearly (Level 6), and yearly (Level 12) series. • In step 2, each one of the series is forecast for a complete year ahead. Note that the monthly data require forecasts of up to 12 steps ahead, while in the yearly data a single 1-step-ahead forecast suffices. Note too that all the forecasts are flat, reflecting the intermittency (for the monthly and quarterly) and lack of trend in the annual data. • Lastly, in step 3, the forecasts are backtransformed into the original (monthly) data frequency, and they are combined in the final forecast using a simple average.
One problem that can arise from the application of the MAPA concerns the proper modeling of seasonality. Consider the case of monthly data, which are aggregated to quarters and years. Any seasonality in the monthly data may be partly filtered out at the quarterly level and will be completely removed in the annual series. If we combine forecasts derived from the seasonal monthly data with the monthly transformed forecasts derived from the quarterly and annual data, the seasonal pattern will be unduly dampened. One proposal (Kourentzes and colleagues, 2014) to avoid this problem is that the combination should be done on model components instead of the forecasts. Within the exponential-smoothing family – the most common basis of automatic modeling algorithms in the software – estimates are calculated and shown for each model component: level, trend, and seasonality. The seasonal component will be combined only on those aggregation levels where seasonality is modeled; for example, the monthly and quarterly series. On the other hand, level and trend (if one exists) will be modeled at each level. In short, instead of combining forecasts, we combine level, trend, and seasonal components from the various aggregation levels and use the combination to generate the final forecast. An illustration of this procedure is shown in the appendix. Other ways of tackling the seasonality issue would include the consideration of only some of the aggregation levels, or the introduction of models that can deal with fractional seasonality.
www.forecasters.org/foresight FORESIGHT
15
IS MAPA WORTH THE EXTRA EFFORT? often done in an ad hoc manner, often with The short answer is a likely “yes”! The MAPA approach has been tested on both fastmoving and slow-moving demand data, and found to improve forecasting performance (both accuracy and bias) compared to traditional approaches (Kourentzes and colleagues, 2014; Petropoulos and Kourentzes, at press). For fast-moving data, MAPA improves on exponential smoothing at most data frequencies, while being especially accurate for longer-term forecasts. This is a direct outcome of fitting models at the higher aggregation levels, where the level and the longterm trend of the series are best identified. In the case of slow-moving data, MAPA outperformed any single forecasting method. Another of MAPA’s advantages is that you don’t have to select a single aggregation level (monthly or weekly, etc.) for modeling the data. Removing this restriction simplifies the forecasting process and hedges against risks of selecting a suboptimal frequency for forecasting. But it’s not only about forecast accuracy: a key advantage with MAPA is organisational. MAPA supplies reconciled forecasts across all frequencies, aligning operational, tactical, and strategic decision making. Since the same forecast can be used for all three levels of planning, there is no need to convert the final forecasts from one frequency to another, something that is
detrimental effects. MAPA facilitates the drive toward the “one-number” forecast, where many decisions and organisational functions are based on the same view of the future. You have seen that short-term operational forecasts, driving demand planning and inventory management, are often incompatible with long-term budget forecasts. MAPA addresses this issue by providing a reconciled view across the various planning horizons, a big step toward fully reconciled forecasts within an industrial setting.
APPENDIX: USING MAPA in R If you are interested in using this approach for forecasting, a starting point is the MAPA package for R, which is available at the CRAN repository or at the authors’ websites. This is for using R, the excellent forecasting package described in Foresight by Kolassa and Hyndman (2010), for the estimation of exponential smoothing.
The code automatically handles aggregation, model fit, component estimation, and combination and calculation of the final forecasts. Figure 5 provides an example of the output, where one can inspect the various models fitted at the Figure 5. Example of the Visual Output of the MAPA Function in MAPA Package for R different aggregation levels, in-sample fit, forecasts, and prediction intervals. The abbreviation used follows the conventional exponential smoothing notation, where A is additive, M is
16 FORESIGHT Summer 2014
multiplicative, N is none, and d refers to damped trend.
Figure 6. Example of the Visual Output of the Mapasimple Function
There are several options available for the estimation and calculation of MAPA forecasts, but at a basic level a single command is enough. Another interesting view is provided by the mapasimple function that plots the various components fitted at the different aggregation levels and their combinations.
Figure 6 provides an example of the output. It is apparent that, at the different aggregation levels, very different exponentialsmoothing models are fitted, resulting in different level, trend, and seasonality estimates. The estimates of the components (level, trend, and seasonality) for each aggregation level are presented in the respective panels. This information is subsequently averaged to provide the final estimate (in black) for each component. The rest of the lines in the plots are the components at various aggregation levels. For example, red refers to aggregation level 1 (i.e., the original data), orange to aggregation level 2, and yellow refers to aggregation level 3 (see also in Figure 5 that this was the only level where trend is identified). One can explore the different options in the MAPA package “help” file, or in the original article (Kourentzes et al., 2014).
Petropoulos, F. & Kourentzes, N. (at press). Forecast Combinations for Intermittent Demand, Journal of the Operational Research Society. Syntetos, A.A., Boylan, J.E., Croston, J.D. (2005). On the Categorization of Demand Patterns, Journal of the Operational Research Society, 56 (5), 495–503.
Fotios Petropoulos is a Senior
Research Associate at the Lancaster Centre for Forecasting, Lancaster University, in the UK. Previously he served as Coordinator and Research Associate of the Forecasting & Strategy Unit of the National Technical University of Athens, where he also completed his doctoral in engineering. He is engaged in research on improving forecasting processes.
[email protected]
References Kolassa, S. & Hyndman, R.J. (2010). Free Open-Source Forecasting Using R, Foresight, Issue 17 (Spring 2010), 19-24.
Nikolaos Kourentzes
Kostenko, A.V. & Hyndman, R.J. (2006). A Note on the Categorization of Demand Patterns, Journal of the Operational Research Society, 57, 1256–1257.
is an Assistant Professor at Lancaster University and a researcher at the Lancaster Centre for Forecasting, UK. His research addresses forecasting issues of model selection and combination, temporal aggregation, intermittent demand, promotional modeling, and supply-chain
Kourentzes, N., Petropoulos, F. & Trapero Arenas, J.R. (2014b). Improving Forecasting by Estimating Time Series Structural Components across Multiple Frequencies, International Journal of Forecasting, 30 (2), 291–302. Nikolopoulos, K., Syntetos, A., Boylan, J.H., Petropoulos, F. & Assimakopoulos, V. (2011). An Aggregate - Disaggregate Intermittent Demand Approach (ADIDA) to Forecasting: an Empirical Proposition and Analysis, Journal of the Operational Research Society, 62, 544–554.
collaboration.
[email protected]
www.forecasters.org/foresight FORESIGHT
17