<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Archives Applied forecasting - Open Forecasting</title>
	<atom:link href="https://openforecast.org/category/applied-forecasting/feed/" rel="self" type="application/rss+xml" />
	<link>https://openforecast.org/category/applied-forecasting/</link>
	<description>How to look into the future</description>
	<lastBuildDate>Mon, 19 Jan 2026 11:31:41 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2015/08/cropped-usd-05-32x32.png&amp;nocache=1</url>
	<title>Archives Applied forecasting - Open Forecasting</title>
	<link>https://openforecast.org/category/applied-forecasting/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Risky business: how to select your model based on risk preferences</title>
		<link>https://openforecast.org/2026/01/19/risky-business-how-to-select-your-model-based-on-risk-preferences/</link>
					<comments>https://openforecast.org/2026/01/19/risky-business-how-to-select-your-model-based-on-risk-preferences/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Mon, 19 Jan 2026 11:28:04 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Papers]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[Theory of forecasting]]></category>
		<category><![CDATA[error measures]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<category><![CDATA[Information criteria]]></category>
		<category><![CDATA[model combination]]></category>
		<category><![CDATA[model selection]]></category>
		<category><![CDATA[papers]]></category>
		<category><![CDATA[theory]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3950</guid>

					<description><![CDATA[<p>What do you use for model selection? Do you select the best model based on its cross-validated performance, or do you use in-sample measures like AIC? If so, there is a way to improve your selection process further. JORS recently published the paper of Nikos Kourentzes and I based on a simple but powerful idea: [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2026/01/19/risky-business-how-to-select-your-model-based-on-risk-preferences/">Risky business: how to select your model based on risk preferences</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>What do you use for model selection? Do you select the best model based on its cross-validated performance, or do you use in-sample measures like AIC? If so, there is a way to improve your selection process further.</p>
<p>JORS recently published the paper of Nikos Kourentzes and I based on a simple but powerful idea: instead of using summary statistics (like the mean RMSE of cross-validated errors), you should consider the entire distribution and choose a specific quantile. This aligns with <a href="https://openforecast.org/2024/03/27/what-does-lower-error-measure-really-mean/">my previous post on error measures</a>, but here is the core intuition:</p>
<p>The distribution of error measures is almost always asymmetric. If you only look at the average, you end up with a &#8220;mean temperature in the hospital&#8221; statistic, which doesn&#8217;t reflect how models actually behave. Some models perform great on most series but fail miserably on a few.</p>
<p>What can we do in this case? We can look at quantiles of distribution.</p>
<p>For example, if we use 84th quantile, we compare the models based on their &#8220;bad&#8221; performance, situations where they fail and produce less accurate forecasts. If you choose the best performing model there, you will end up with something that does not fail as much. So your preferences for the model become risk-averse in this situation.</p>
<p>If you focus on the lower quantile (e.g. 16th), you are looking at models that do well on the well-behaved series and ignore how they do on the difficult ones. So, your model selection preferences can be described as risk-tolerant, because you are accept that the best performing model might fail on a difficult time series.</p>
<p>Furthermore, the median (50th quantile, the middle of sample), corresponds to the risk-neutral situation, because it ignores the tails of the distribution.</p>
<p>What about the mean? This is a risk-agnostic strategy, because it says nothing about the performance on the difficult or easy time series &#8211; it takes everything and nothing in it at the same time, hiding the true risk profile.</p>
<p>So what?</p>
<p>In the paper, we show that using a risk-averse strategy tends to improve overall forecasting accuracy in day-to-day situations. Conversely, a risk-tolerant strategy can be beneficial when disruptions are anticipated, as standard models are likely to fail anyway.</p>
<p>So, next time you select a model, think about the measure you are using. If it’s just the mean RMSE, keep in mind that you might be ignoring the inherent risks of that selection.</p>
<p>P.S. While the discussion above applies to the distribution of error measures, our paper specifically focused on point AIC (in-sample performance). But it is a distance measure as well, so the logic explained above holds.</p>
<p>P.P.S. Nikos wrote a <a href="https://www.linkedin.com/posts/nikos-kourentzes-3660515_forecasting-datascience-analytics-activity-7414687127269007360-pLAh">post about this paper here</a>.</p>
<p>P.P.P.S. And here is <a href="https://github.com/trnnick/working_papers/blob/fd1973624e97fc755a9c2401f05c78b056780e34/Kourentzes_2026_Incorporating%20risk%20preferences%20in%20forecast%20selectionk.pdf">the link to the paper</a>.</p>
<p>Message <a href="https://openforecast.org/2026/01/19/risky-business-how-to-select-your-model-based-on-risk-preferences/">Risky business: how to select your model based on risk preferences</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2026/01/19/risky-business-how-to-select-your-model-based-on-risk-preferences/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Review of a paper on comparison of modern machine learning techniques in retail</title>
		<link>https://openforecast.org/2025/06/22/review-of-a-paper-comparative-analysis-of-modern-machine-learning-models-for-retail-sales-forecasting/</link>
					<comments>https://openforecast.org/2025/06/22/review-of-a-paper-comparative-analysis-of-modern-machine-learning-models-for-retail-sales-forecasting/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Sun, 22 Jun 2025 21:59:19 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Papers]]></category>
		<category><![CDATA[Theory of forecasting]]></category>
		<category><![CDATA[AI and ML]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<category><![CDATA[papers]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3874</guid>

					<description><![CDATA[<p>A couple of days ago, I noticed a link to the following paper in a post by Jack Rodenberg: https://arxiv.org/abs/2506.05941v1. The topic seemed interesting and relevant to my work, so I read it, only to find that the paper contains several serious flaws that compromise its findings. Let me explain. Introduction But first, why am [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2025/06/22/review-of-a-paper-comparative-analysis-of-modern-machine-learning-models-for-retail-sales-forecasting/">Review of a paper on comparison of modern machine learning techniques in retail</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A couple of days ago, I noticed a link to the following paper in a post by Jack Rodenberg: <a href="https://arxiv.org/abs/2506.05941v1" target="_blank">https://arxiv.org/abs/2506.05941v1</a>. The topic seemed interesting and relevant to my work, so I read it, only to find that the paper contains several serious flaws that compromise its findings. Let me explain.</p>
<h2>Introduction</h2>
<p>But first, why am I writing this post?</p>
<p>There’s growing interest in forecasting among data scientists, data engineers, ML experts etc. Many of them assume that they can apply their existing knowledge directly to this new area without reading domain-specific literature. As a result, we get a lot of &#8220;hit-or-miss&#8221; work: sometimes having promising ideas, but executed in ways that violate basic forecasting principles. The main problem with that is that if your experiment is not done correctly, your results might be compromised, i.e. your claims might be simply wrong.</p>
<p>If you&#8217;re a researcher writing forecasting-related papers, then hopefully reading this post (and the posts and papers I refer to), will help you improve your papers. This might lead to a smoother peer-review process. Also, while I can’t speak for other reviewers, if I come across a paper with similar issues, I typically give it a hard time.</p>
<p>I should also say that I am not a reviewer of this paper (I would not publish a review), but I merely decided to demonstrate what issues I can see when I read papers like that. The authors are just unlucky that I picked their paper&#8230;</p>
<p>Let&#8217;s start.</p>
<p>The authors apply several ML methods to retail data, compare their forecasting accuracy, and conclude that XGBoost and LightGBM outperform N-BEATS, NHITS, and Temporal Fusion Transformer. While the finding isn’t groundbreaking, additional evidence on a new dataset is always welcome.</p>
<h2>Major issues</h2>
<p>So, what&#8217;s wrong? Here is a list of the major comments:</p>
<ol>
<li><strong>Forecast horizon vs. data frequency</strong>:</li>
<p>Daily data with a 365-day forecast horizon makes no practical sense (page 2, paragraph 3). I haven&#8217;t seen any company making daily-level decisions a year in advance. Stock decisions are typically made on much shorter horizons, and if you need a year ahead forecast, you definitely do not need it on the daily level. After all, there is no point in knowing that on 22nd December 2025 you will have the expected demand of 35.457 units &#8211; it is too far into the future to make any difference. Some references:</p>
<ul>
<li><a href="https://doi.org/10.1016/j.ijforecast.2022.08.003">Athanasopoulos and Kourentzes (2023)</a> paper discusses data frequency and some decisions related to them;</li>
<li>and there is <a href="/2024/09/24/how-to-choose-forecast-horizon/">a post on my website</a> on a related topic</li>
</ul>
<li><strong>Misuse of SBC classification</strong>:</li>
<p>Claiming that 70% of products are &#8220;intermittent&#8221; (page 2, last paragraph) based on SBC is incorrect. Furthermore, SBC classification does not make sense in this setting, and is not used in the paper anyway, so the authors should just drop it.</p>
<ul>
<li>Read more about it <a href="/2025/06/04/sbc-is-not-for-you/">here</a>.</li>
<li>And there is <a href="https://www.linkedin.com/posts/stephankolassa_on-the-categorization-of-demand-patterns-activity-7340669762894462978-Wjrb">a post of Stephan Kolassa</a> on exactly this point</li>
</ul>
<li><strong>Product elimination and introduction is unclear (page 3):</strong></li>
<p>The authors say &#8220;Around 30% of products were eliminated during training and 10% are newly introduced in validation&#8221;. It&#8217;s not clear why this was done and how specifically. This needs to be explained in more detail.</p>
<li><strong>&#8220;Missing values&#8221; undefined</strong>:</li>
<p>It is not clear what the authors mean by &#8220;missing values&#8221; (page 3, &#8220;Handling Missing Values&#8221;). How do they appear and why? Are they the same as stockouts, or were there some other issues in the data? This needs to be explained in more detail.</p>
<li><strong>Figure 1 is vague</strong>:</li>
<p>Figure 1 is supposed to explain how the missing values were treated. But the whole imputation process is questionable, because it is not clear how well it worked in comparison with alternatives and how reasonable it is to have an imputed series that look more erratic than the original one. The discussion of that needs to be expanded with some insights from the business problem.</p>
<li><strong>No stockout handling discussion</strong>:</li>
<p>The authors do not discuss whether the data has stockouts or not. This becomes especially important in retail, because if the stockouts are not treated correctly, you would end up forecasting sales instead of demand</p>
<ul>
<li>For example, <a href="/2025/04/11/svetunkov-sroginis-2025-model-based-demand-classification/">see this post</a>.</li>
</ul>
<li><strong>Feature engineering is opaque</strong>:</li>
<p>&#8220;Lag and rolling-window statistics for sales and promotional indicators were created&#8221; (page 3, &#8220;Feature Engineering&#8221;) &#8211; it is not clear, what specific lags, what length of rolling windows, and what statistics (anything besides mean?) were created. These need to be explained for transparency and so that a reader could better understand what specifically was done. Without this explanation, it is not clear whether the features are sensible at all.</p>
<li><strong>Training/validation setup not explained</strong>:</li>
<p>It is not clear how specifically the split into training and validation sets was done (page 3, last paragraph), and whether the authors used rolling origin (aka time series cross-validation). If they did random splits, that could cause some issues, because the first law of time series is not to break its structure!</p>
<li><strong>Variables transformation is unclear</strong>:</li>
<p>It is not clear whether any transformations of the response variable were done. For example, if the data is not stationary, taking differences might be necessary to capture the trend and to do extrapolation correctly. Normalisation of variables is also important for neural networks, unless this is built-in in the functions the authors used. This is not discussed in the paper.</p>
<li><strong>Forecast strategy not explained</strong>:</li>
<p>It is not clear whether the direct or recursive strategy was used for forecasting. If lags were not used in the model, that would not matter, but they are, so this becomes a potential issue. Also, if the authors used the lag of the actual value on observation 235 steps ahead to produce forecast for 236 steps ahead, then this is another fundamental issue, because that implies that the forecast horizon is just 1 step ahead, and not 365, as the authors claim. This needs to be explained in more detail.</p>
<ul>
<li>I&#8217;ve written <a href="/2024/05/25/recursive-vs-direct-forecasting-strategy/">a post</a> about the strategies.</li>
</ul>
<li><strong>No statistical benchmarks</strong>:</li>
<p>At the very least, the authors should use simple moving average and probably exponential smoothing. Even if they do not perform well, this gives an additional information about the performance of the other approaches. Without them, the claims about good performance of the used ML approaches are not supported by evidence. The authors claim that they used mean as a benchmark, but its performance is not discussed in the paper.</p>
<ul>
<li><a href="/2024/10/28/why-is-it-hard-to-beat-simple-moving-average/">A post on the Simple Moving Average</a></li>
<li><a href="/2024/01/10/why-you-should-care-about-exponential-smoothing/">Why you should care about the exponential smoothing</a></li>
</ul>
<li><strong>Issues with forecast evaluation</strong>:</li>
<p>The whole Table 3 with error measures is an example of what not to do. Here are some of major issues:</p>
<ol>
<li><a href="/2024/04/03/stop-reporting-several-error-measures-just-for-the-sake-of-them/">There is no point in reporting several error measures</a> &#8211; each one of them is minimised by their own statistics. The error measure should align with what approaches produce.</li>
<li>MSE, RMSE, MAE and ME should be dropped, because they are not scaled, so the authors are adding up error measures for bricks and nails. The result is meaningless.</li>
<li>MASE is not needed &#8211; it is minimised by median, which could be a serious issue on intermittent demand <a href="/2025/01/21/don-t-use-mae-based-error-measures-for-intermittent-demand/">see this post</a>. wMAPE has similar issues because it is also based on MAE.</li>
<li>If the point forecasts are produced in terms of medians (like in case of NBEATS), then RMSSE should be dropped, and MASE should be used instead.</li>
<li>But also, comparing means with medians is not a good idea. If you assume a symmetric distribution, the two should coincide, but in general this might not hold.</li>
<li>R2 is not a good measure of forecast accuracy. It makes some sense in regression context for linear models, but in this one, it is pointless, and only shows that the authors don&#8217;t fully understand what they are doing. Plus, it&#8217;s not clear how specifically it was calculated.</li>
<li>I don&#8217;t fully understand &#8220;demand error&#8221;, &#8220;demand bias&#8221; and other measures, and the authors do not explain them in necessary detail. This needs to be added to the paper.</li>
<li>The split into &#8220;Individual Groups&#8221; and &#8220;Whole Category&#8221; is not well explained either: it is not clear what this means, why, and how this was done.</li>
<li>And in general, I don&#8217;t understand what the authors want to do with Cases A &#8211; D in Table 3. It is not clear why they are needed, and what they want to show with them. This is not explained in the paper.</li>
</ol>
<ul>
<li>I have a series of posts on forecast evaluation <a href="/category/forecasting-theory/forecast-evaluation/">here</a>.</li>
</ul>
<li><strong>Invalid analysis of bias measures</strong>:</li>
<p>Analysis of bias measures is meaningless because they were not scaled.</p>
<li><strong>Disturbing bias of NBEATS in Figure 2</strong>:</li>
<p>The bias shown in Figure 2 is disturbing and should be dealt with prior to evaluation. It could have appeared due to the loss function used for training or because the data was not pre-processed correctly. Leaving it as is and blaming NBEATS for this does not sound reasonable to me.</p>
<li><strong>No inventory implications</strong>:</li>
<p>The authors mention inventory management, but stop on forecasting, not showing how the specific forecasts translate to inventory decisions. If this paper was to be submitted to any operations-related journal, the inventory implications would need to be added in the discussion.</p>
<li><strong>Underexplained performance gaps</strong>:</li>
<p>The paper also does not explain well why neural networks performed worse than gradient boosting methods. They mention that this could be due to the effect of missing values, but this is a speculation rather than an explanation, which I personally do not believe (I might be wrong). While the overall results make sense for me personally, if you want to publish a good paper, you need to provide a more detailed answer to the question &#8220;why?&#8221;.
</ol>
<h3>Minor issues</h3>
<p>I also have three minor comments:</p>
<ol>
<li>&#8220;many product series are censored&#8221; (page 2, last paragraph) is not what it sounds like. The authors imply that the histories are short, while the usual interpretation is that the sales are lower than the demand, so the values are censored. I would rewrite this.</li>
<li>Figure 2 has the legend saying &#8220;Poisson&#8221; three times, not providing any useful information. This is probably just a mistake, which can easily be fixed.</li>
<li>There are no references to Table 2 and Figure 3 in the paper. It is not clear why they are needed. Every table and figure should be referred to and explained.</li>
</ol>
<h2>Conclusions</h2>
<p>Overall, the paper has a sensible idea, but I feel that the authors need to learn more about forecasting principles and that they have not read forecasting literature carefully to understand how specifically the experiments should be designed, what to do, and not to do (stop using SBC!). Because they made several serious mistakes, I feel that the results of the paper are compromised and might not be correct.</p>
<p>P.S. If I were a reviewer of this paper, I would recommend either &#8220;reject and resubmit&#8221; or a &#8220;major revision&#8221; (if the former option was not available).</p>
<p>P.P.S. If the authors of the paper are reading this, I hope you find these comments useful. If you have not submitted the paper yet, I&#8217;d suggest to take some of them (if not all) into account. Hopefully, this will smooth the submission process for you.</p>
<p>Message <a href="https://openforecast.org/2025/06/22/review-of-a-paper-comparative-analysis-of-modern-machine-learning-models-for-retail-sales-forecasting/">Review of a paper on comparison of modern machine learning techniques in retail</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2025/06/22/review-of-a-paper-comparative-analysis-of-modern-machine-learning-models-for-retail-sales-forecasting/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Six questions for a forecaster-consultant</title>
		<link>https://openforecast.org/2025/05/28/six-questions-for-a-forecaster-consultant/</link>
					<comments>https://openforecast.org/2025/05/28/six-questions-for-a-forecaster-consultant/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Wed, 28 May 2025 11:48:31 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[consultancy]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3844</guid>

					<description><![CDATA[<p>NHS has a helpful page with a set of questions you can ask your GP to ensure you receive the right treatment for your illness. Surprisingly, these questions can be applied in other fields as well. Here’s an example in applied forecasting, working with companies. I’m not going to go through all of them, I [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2025/05/28/six-questions-for-a-forecaster-consultant/">Six questions for a forecaster-consultant</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>NHS has <a href="https://www.nhs.uk/nhs-services/gps/what-to-ask-your-doctor/">a helpful page</a> with a set of questions you can ask your GP to ensure you receive the right treatment for your illness. Surprisingly, these questions can be applied in other fields as well. Here’s an example in applied forecasting, working with companies.</p>
<p>I’m not going to go through all of them, I picked several most useful. These are questions you can ask a consultant who is helping you (as a client). But they can also help you (as a consultant) deliver a better product for your client.</p>
<ol>
<li>What are the alternative approaches you could try? (Are there other ways to treat my condition?)</li>
<p>If a consultant presents only one approach and says it’s the best, they may have found something that works for them but not necessarily for you. Ask whether they’ve tried other approaches on your data. A fancy neural network might do a great job, but a gradient boosting method, or even a simple statistical one, could perform similarly. After all, there is no such thing as <a href="/2025/03/06/there-is-no-such-thing-as-the-best-approach-for-everything/">the best approach for everything</a>. If a consultant says there are no alternatives, find a new one.</p>
<li>What are the drawbacks of the proposed approach? (Are there any side effects or risks? If so, what are they?)</li>
<p><a href="/2025/01/07/there-is-no-such-thing-as-assumption-free-approach/">Every approach relies on assumptions</a>. If they are violated, the approach may fail. Understanding when and why this might happen is crucial. For example, the method might assume an inappropriate distribution (e.g. Normal for intermittent demand), or require more data than the company can afford to store. It could be too time-consuming to use in practice, or assume that the end users know what they are doing. There are always assumptions and trade-offs. If a consultant says, &#8220;There are no drawbacks&#8221;, they’re either lying or don’t understand what they’re doing.</p>
<li>What if we don’t change the process? (What will happen if I don’t have any treatment?)</li>
<p>One of the main responsibilities of a professional consultant is to benchmark new approaches against the current one. This allows them to show exactly what would change and what improvements would it would bring. If they don’t do this, consider it a red flag.</p>
<li>How will the new approach improve our processes? (How effective is this treatment?)</li>
<p>At the very least, a consultant should demonstrate an improvement in accuracy. Even better, they should show how this translates into better decisions and costs reduction (e.g. via inventory simulations). Reducing the workload for demand planners can also be a significant benefit. In any case, ask &#8211; they should know.</p>
<li>Are there parts of the process that should be avoided? (Is there anything I should stop or avoid doing?)</li>
<p>A good consultant should know what can cause issues. e.g. if external information (promotions?) is used in the model, judgmentally adjusting forecasts may do more harm than good. And a good consultant should be able to explain what not to do.</p>
<li>What else should we do? (Is there anything I can do to help myself?)</li>
<p>It’s not enough to just deploy a new approach. End users must understand how to use it. It’s great if demand planners are familiar with forecasting, statistics, and feature engineering, but if not, they might abandon an accurate approach in favour of a simpler, less effective alternative. A consultant should be able to explain what the company can do to make the new approach practical and ensure it delivers value (e.g. train the team).
</ol>
<p>Any other questions you would ask?</p>
<p>Message <a href="https://openforecast.org/2025/05/28/six-questions-for-a-forecaster-consultant/">Six questions for a forecaster-consultant</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2025/05/28/six-questions-for-a-forecaster-consultant/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>5th IMA and OR Society Conference</title>
		<link>https://openforecast.org/2025/05/02/5th-ima-and-or-society-conference/</link>
					<comments>https://openforecast.org/2025/05/02/5th-ima-and-or-society-conference/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Fri, 02 May 2025 14:37:50 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[intermittent demand]]></category>
		<category><![CDATA[presentations]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3832</guid>

					<description><![CDATA[<p>It was a pleasure to attend the 5th IMA and OR Society Conference at Aston University, Birmingham, and to present my research with Anna Sroginis on model-based demand classification. A great crowd of people from universities across the UK, along with several esteemed international colleagues. The event was very well organised &#8211; thanks to Aris [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2025/05/02/5th-ima-and-or-society-conference/">5th IMA and OR Society Conference</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>It was a pleasure to attend the 5th IMA and OR Society Conference at Aston University, Birmingham, and to present my research with Anna Sroginis on model-based demand classification. A great crowd of people from universities across the UK, along with several esteemed international colleagues. The event was very well organised &#8211; thanks to Aris Syntetos, Anna-Lena Sachs, Adam Letchford, Dilek Onkal, and Paresh Date.</p>
<p>My presentation was based on <a href="/2025/04/11/svetunkov-sroginis-2025-model-based-demand-classification/">this paper</a>. And here are the slides:<br />
<a href="https://openforecast.org/wp-content/uploads/2025/05/2025-05-01-IMA-OR.pdf">2025-05-01-IMA-OR</a></p>
<p>Message <a href="https://openforecast.org/2025/05/02/5th-ima-and-or-society-conference/">5th IMA and OR Society Conference</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2025/05/02/5th-ima-and-or-society-conference/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Challenges related to seasonal data: shifting seasonality</title>
		<link>https://openforecast.org/2025/04/07/challenges-related-to-seasonal-data/</link>
					<comments>https://openforecast.org/2025/04/07/challenges-related-to-seasonal-data/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Mon, 07 Apr 2025 12:54:49 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[Theory of forecasting]]></category>
		<category><![CDATA[Seasonality]]></category>
		<category><![CDATA[theory]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3814</guid>

					<description><![CDATA[<p>There are many different issues with capturing seasonality in time series. In this short post, I&#8217;d like to discuss one of the most annoying ones. I&#8217;m talking about the seasonal pattern that shifts over time. What I mean is that, for example, instead of having the standard number of observations in the cycle (e.g., 24 [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2025/04/07/challenges-related-to-seasonal-data/">Challenges related to seasonal data: shifting seasonality</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There are many different issues with capturing seasonality in time series. In this short post, I&#8217;d like to discuss one of the most annoying ones.</p>
<p>I&#8217;m talking about the seasonal pattern that shifts over time. What I mean is that, for example, instead of having the standard number of observations in the cycle (e.g., 24 hours in a day), in some cases you can have more or fewer of them. How is that possible?</p>
<p>One of these issues is the Daylight Saving Time (DST) change. The original idea of DST was to reduce energy consumption because daylight in summer is longer than in winter (there&#8217;s a nice and long article on Wikipedia about it). Because of this, many countries introduced a time shift: in spring, the clock is moved forward by one hour, while in autumn it goes back. This idea had a reasonable motivation at the beginning of the 20th century, but I personally think that as we&#8217;ve progressed as a society, it has lost its value. While this is already extremely annoying on its own, a bit unhealthy (several studies report an increased risk of heart attacks), and a torture for parents with small kids (the little ones don&#8217;t understand that it&#8217;s not 7am yet), it also introduces a modelling challenge: two days in the year do not have 24 hours. In spring, we have 23 hours, while in autumn we have 25. Standard classical forecasting approaches (such as ETS/ARIMA, regression, STL or classical decomposition) break in this case, because by default they assume that a specific pattern repeats itself every 24 hours. The issue arises because business cycles are tuned to working hours, not to the movement of the sun &#8211; people come to work at 9am, no matter how many hours are in the day.</p>
<p>Another challenge is leap years. While DST is totally man-made, leap years occur because the Earth orbits the sun approximately every 365.25 days. To avoid drifting too far from reality, our calendars include one extra day every four years (29th February). This addresses the issue but also means that one year has 366 days instead of 365. Once again, conventional models relying on fixed periodicity fail.</p>
<p>There are several ways to handle this, all with their own advantages and disadvantages:</p>
<ol>
<li>Fix the data. In the case of DST, this means removing one of the duplicated hours during the autumn time change and adding one during the spring shift. For leap years, it means dropping the 29th of February. This is easy to do, but breaks the structure and might cause issues when we have DST/leap year in the holdout sample.</li>
<li>Introduce more complex components, such as Fourier-based ones, to capture the shift in the data. This works well for leap years but doesn&#8217;t address the DST issue. <a href="https://doi.org/10.1016/j.energy.2015.02.100)">Harmonic regressions</a> and <a href="https://doi.org/10.1198/jasa.2011.tm09771">TBATS</a> do this, for example.</li>
<li><a href="https://openforecast.org/adam/MultipleFrequenciesDSTandLeap.html">Shift seasonal indices</a> when the issue happens &#8211; for example, having two indices for 1am when the switch to winter time occurs.</li>
</ol>
<p>In R, I’ve developed the <code>temporaldummy()</code> function in the <code>greybox</code> package to introduce correct dummy variables for data with shifting seasonality, and I’ve incorporated method (3) into the <code>adam()</code> function from the smooth package. You can read more about these here: https://openforecast.org/adam/MultipleFrequenciesDSTandLeap.html</p>
<p>Are there any other strategies? Which one do you prefer?</p>
<p>BTW, Kandrika Pritularga and I are running a course on Demand Forecasting Principles with Examples in R. We’ll discuss some of these aspects there. Read more about it <a href="https://lancaster.ac.uk/centre-for-marketing-analytics-and-forecasting/grow-with-us/demand-forecasting-with-r/">here</a>.</p>
<p>Message <a href="https://openforecast.org/2025/04/07/challenges-related-to-seasonal-data/">Challenges related to seasonal data: shifting seasonality</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2025/04/07/challenges-related-to-seasonal-data/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Methods for the smooth functions in R</title>
		<link>https://openforecast.org/2024/10/10/methods-for-the-smooth-functions-in-r/</link>
					<comments>https://openforecast.org/2024/10/10/methods-for-the-smooth-functions-in-r/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Thu, 10 Oct 2024 13:46:22 +0000</pubDate>
				<category><![CDATA[adam()]]></category>
		<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Package smooth for R]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[smooth]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3685</guid>

					<description><![CDATA[<p>I have been asked recently by a colleague of mine how to extract the variance from a model estimated using adam() function from the smooth package in R. The problem was that that person started reading the source code of the forecast.adam() and got lost between the lines (this happens to me as well sometimes). [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2024/10/10/methods-for-the-smooth-functions-in-r/">Methods for the smooth functions in R</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I have been asked recently by a colleague of mine how to extract the variance from a model estimated using <code>adam()</code> function from the <code>smooth</code> package in R. The problem was that that person started reading the source code of the <code>forecast.adam()</code> and got lost between the lines (this happens to me as well sometimes). Well, there is an easier solution, and in this post I want to summarise several methods that I have implemented in the <code>smooth</code> package for forecasting functions. In this post I will focus on the <code>adam()</code> function, although all of them work for <code>es()</code> and <code>msarima()</code> as well, and some of them work for other functions (at least as for now, for smooth v4.1.0). Also, some of them are mentioned in the <a href="https://openforecast.org/adam/cheatSheet.html">Cheat sheet for adam() function</a> of my monograph (available <a href="https://openforecast.org/adam/">online</a>).</p>
<p><!-- Before I start, I have a <strong>short announcement</strong>. Kandrika Pritularga and I are planning to host the first online course on "Demand Forecasting with R" in November 2024. There are still some places left, so you can register via <a href="https://online-payments.lancaster-university.co.uk/product-catalogue/courses/lancaster-university-management-school-lums/centre-for-marketing-analytics-forecasting-cmaf/demand-forecasting-with-r">the Lancaster University shop</a>. You can read about the course <a href="https://www.lancaster.ac.uk/centre-for-marketing-analytics-and-forecasting/grow-with-us/demand-forecasting-with-r/">here</a>. --></p>
<h3>The main methods</h3>
<p>The <code>adam</code> class supports several methods that are used in other packages in R (for example, for the <code>lm</code> class). Here are they:</p>
<ul>
<li><code>forecast()</code> and <code>predict()</code> &#8211; produce forecasts from the model. The former is preferred, the latter has a bit of limited functionality. See documentation to see what forecasts can be generated. This was also discussed in <a href="https://openforecast.org/adam/ADAMForecasting.html">Chapter 18</a> of my monograph.</li>
<li><code>fitted()</code> &#8211; extracts the fitted values from the estimated object;</li>
<li><code>residuals()</code> &#8211; extracts the residuals of the model. These are values of \(e_t\), which differ depending on the error type of the model (see <a href="https://openforecast.org/adam/non-mle-based-loss-functions.html">discussion here</a>);</li>
<li><code>rstandard()</code> &#8211; returns standardised residuals, i.e. residuals divided by their standard deviation;</li>
<li><code>rstudent()</code> &#8211; studentised residuals, i.e. residuals that are divided by their standard deviation, dropping the impact of each specific observation on it. This helps in case of influential outliers.</li>
</ul>
<p>An additional method was introduced in the <code>greybox</code> package, called <code>actuals()</code>, which allows extracting the actual values of the response variable. Another useful method is <code>accuracy()</code>, which returns a set of error measures using the <code>measures()</code> function of the <code>greybox</code> package for the provided model and the holdout values.</p>
<p>All the methods above can be used for model diagnostics and for forecasting (the main purpose of the package). Furthermore, the <code>adam</code> class supports several functions for working with coefficients of models, similar to how it is done in case of <code>lm</code>:</p>
<ul>
<li><code>coef()</code> or <code>coefficient()</code> &#8211; extracts all the estimated coefficients in the model;</li>
<li><code>vcov()</code> &#8211; extracts the covariance matrix of parameters. This can be done either using Fisher Information or via a bootstrap (<code>bootstrap=TRUE</code>).  In the latter case, the <code>coefbootstrap()</code> method is used to create bootstrapped time series, reapply the model and extract estimates of parameters;</li>
<li><code>confint()</code> &#8211; returns the confidence intervals for the estimated parameter. Relies on <code>vcov()</code> and the assumption of normality (<a href="https://openforecast.org/adam/ADAMUncertaintyConfidenceInterval.html">CLT</a>);</li>
<li><code>summary()</code> &#8211; returns the output of the model, containing the table with estimated parameters, their standard errors and confidence intervals.</li>
</ul>
<p>Here is an example of an output from an ADAM ETS estimated using <code>adam()</code>:</p>
<pre class="decode">adamETSBJ <- adam(BJsales, h=10, holdout=TRUE)
summary(adamETSBJ, level=0.99)</pre>
<p>The first line above estimates and selects the most appropriate ETS for the data, while the second one will create a summary with 99% confidence intervals, which should look like this:</p>
<pre>Model estimated using adam() function: ETS(AAdN)
Response variable: BJsales
Distribution used in the estimation: Normal
Loss function type: likelihood; Loss function value: 241.1634
Coefficients:
      Estimate Std. Error Lower 0.5% Upper 99.5%  
alpha   0.8251     0.1975     0.3089      1.0000 *
beta    0.4780     0.3979     0.0000      0.8251  
phi     0.7823     0.2388     0.1584      1.0000 *
level 199.9314     3.6753   190.3279    209.5236 *
trend   0.2178     2.8416    -7.2073      7.6340  

Error standard deviation: 1.3848
Sample size: 140
Number of estimated parameters: 6
Number of degrees of freedom: 134
Information criteria:
     AIC     AICc      BIC     BICc 
494.3268 494.9584 511.9767 513.5372</pre>
<p>How to read this output, is discussed in <a href="https://openforecast.org/adam/ADAMUncertaintyConfidenceInterval.html">Section 16.3</a>.</p>
<h3>Multistep forecast errors</h3>
<p>There are two methods that can be used as additional analytical tools for the estimated model. Their generics are implemented in the <code>smooth</code> package itself:</p>
<ol>
<li><code>rmultistep()</code> - extracts the multiple steps ahead in-sample forecast errors for the specified horizon. This means that the model produces the forecast of length <code>h</code> for every observation starting from the very first one, till the last one and then calculates forecast errors based on it. This is used in case of semiparametric and nonparametric prediction intervals, but can also be used for diagnostics (see, for example, <a href="https://openforecast.org/adam/diagnosticsResidualsIIDExpectation.html#diagnosticsResidualsIIDExpectationMultiple">Subsection 14.7.3</a>);</li>
<li><code>multicov()</code> - returns the covariance matrix of the h steps ahead forecast error. The diagonal of this matrix corresponds to the h steps ahead variance conditional on the in-sample information.</li>
</ol>
<p>For the same model that we used in the previous section, we can extract and plot the multistep errors:</p>
<pre class="decode">rmultistep(adamETSBJ, h=10) |> boxplot()
abline(h=0, col="red2", lwd=2)</pre>
<p>which will result in:<br />
<div id="attachment_3689" style="width: 310px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamBJETSMulti.png&amp;nocache=1"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-3689" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamBJETSMulti-300x210.png&amp;nocache=1" alt="Distributions of the multistep forecast errors" width="300" height="210" class="size-medium wp-image-3689" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamBJETSMulti-300x210.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamBJETSMulti-768x538.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamBJETSMulti.png&amp;nocache=1 1000w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-3689" class="wp-caption-text">Distributions of the multistep forecast errors</p></div>
<p>The image above shows that the model tend to under shoot the actual values in-sample (because the boxplots tend to lie slightly above the zero line). This might cause a bias in the final forecasts.</p>
<p>The covariance matrix of the multistep forecast error looks like this in our case:</p>
<pre class="decode">multicov(adamETSBJ, h=10) |> round(3)</pre>
<pre>       h1    h2     h3     h4     h5     h6     h7     h8     h9    h10
h1  1.918 2.299  2.860  3.299  3.643  3.911  4.121  4.286  4.414  4.515
h2  2.299 4.675  5.729  6.817  7.667  8.333  8.853  9.260  9.579  9.828
h3  2.860 5.729  8.942 10.651 12.250 13.501 14.480 15.246 15.845 16.314
h4  3.299 6.817 10.651 14.618 16.918 18.979 20.592 21.854 22.841 23.613
h5  3.643 7.667 12.250 16.918 21.538 24.348 26.808 28.733 30.239 31.417
h6  3.911 8.333 13.501 18.979 24.348 29.515 32.753 35.549 37.737 39.448
h7  4.121 8.853 14.480 20.592 26.808 32.753 38.372 41.964 45.036 47.440
h8  4.286 9.260 15.246 21.854 28.733 35.549 41.964 47.950 51.830 55.127
h9  4.414 9.579 15.845 22.841 30.239 37.737 45.036 51.830 58.112 62.223
h10 4.515 9.828 16.314 23.613 31.417 39.448 47.440 55.127 62.223 68.742</pre>
<p>This is not useful on its own, but can be used for some further derivations.</p>
<p>Note that the returned values by both <code>rmultistep()</code> and <code>multicov()</code> depend on the model's error type (see <a href="https://openforecast.org/adam/non-mle-based-loss-functions.html">Section 11.2</a> for clarification).</p>
<h3>Model diagnostics</h3>
<p>The conventional <code>plot()</code> method applied to a model estimated using <code>adam()</code> can produce a variety of images for the visual model diagnostics. This is controlled by the <code>which</code> parameter (overall, 16 options). The documentation of the <code>plot.smooth()</code> contains the exhaustive list of options and Chapter 14 of the monograph shows how they can be used for model diagnostics. Here I only list several main ones:</p>
<ul>
<li><code>plot(ourModel, which=1)</code> - actuals vs fitted values. Can be used for general diagnostics of the model. Ideally, all points should lie around the diagonal line;</li>
<li><code>plot(ourModel, which=2)</code> - standardised residuals vs fitted values. Useful for detecting potential outliers. Also accepts the <code>level</code> parameter, which regulates the width of the confidence bounds.</li>
<li><code>plot(ourModel, which=4)</code> - absolute residuals vs fitted, which can be used for detecting heteroscedasticity of the residuals;</li>
<li><code>plot(ourModel, which=6)</code> - QQ plot for the analysis of the distribution of the residuals. The specific figure changes for different distribution assumed in the model (see <a href="https://openforecast.org/adam/ADAMETSEstimationLikelihood.html">Section 11.1</a> for the supported ones);</li>
<li><code>plot(ourModel, which=7)</code> - actuals, fitted values and point forecasts over time. Useful for understanding how the model fits the data and what point forecast it produces;</li>
<li><code>plot(ourModel, which=c(10,11))</code> - ACF and PACF of the residuals of the model to detect potentially missing AR/MA elements;</li>
<li><code>plot(ourModel, which=12)</code> - plot of the components of the model. In case of ETS, will show the time series decomposition based on it.</li>
</ul>
<p>And here are four default plots for the model that we estimated earlier:</p>
<pre class="decode">par(mfcol=c(2,2))
plot(adamETSBJ)</pre>
<div id="attachment_3695" style="width: 310px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJPlots.png&amp;nocache=1"><img decoding="async" aria-describedby="caption-attachment-3695" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJPlots-300x210.png&amp;nocache=1" alt="Diagnostic plots for the estimated model" width="300" height="210" class="size-medium wp-image-3695" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJPlots-300x210.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJPlots-768x538.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJPlots.png&amp;nocache=1 1000w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-3695" class="wp-caption-text">Diagnostic plots for the estimated model</p></div>
<p>Based on the plot above, we can conclude that the model fits the data fine, does not have apparent heteroscedasticity, but has several potential outliers, which can be explored to improve it. The outliers detection is done via the <code>outlierdummy()</code> method, the generic of which is implemented in the <code>greybox</code> package.</p>
<h3>Other useful methods</h3>
<p>There are many methods that are used by functions to extract some information about the model. I sometimes use them to simplify my coding routine. Here they are:</p>
<ul>
<li><code>lags()</code> - returns lags of the model. Especially useful if you fit a multiple seasonal model;</li>
<li><code>orders()</code> - the vector of orders of the model. Mainly useful in case of ARIMA, which can have multiple seasonalities and p,d,q,P,D,Q orders;</li>
<li><code>modelType()</code> - the type of the model. In case with the one fitted above will return "AAdN". Can be useful to easily refit the similar model on the new data;</li>
<li><code>modelName()</code> - the name of the model. In case of the one we fitted above will return "ETS(AAdN)";</li>
<li><code>nobs()</code>, <code>nparam()</code>, <code>nvariate()</code> - number of in-sample observations, number of all estimated parameters and number of time series used in the model respectively. The latter one is developed mainly for the multivariate models, such as VAR and VETS (e.g. <code>legion</code> package in R);</li>
<li><code>logLik()</code> - extracts log-Likelihood of the model;</li>
<li><code>AIC()</code>, <code>AICc()</code>, <code>BIC()</code>, <code>BICc()</code> - extract respective information criteria;</li>
<li><code>sigma()</code> - returns the standard error of the residuals.</li>
</ul>
<h3>More specialised methods</h3>
<p>One of the methods that can be useful for scenarios and artificial data generation is <code>simulate()</code>. It will take the structure and parameters of the estimated model and use them to generate time series, similar to the original one. This is discussed in <a href="https://openforecast.org/adam/ADAMUncertaintySimulation.html">Section 16.1</a> of the ADAM monograph.</p>
<p>Furthermore, <code>smooth</code> implements the scale model, discussed in <a href="https://openforecast.org/adam/ADAMscaleModel.html">Chapter 17</a>, which allows modelling time varying scale of distribution. This is done via the <code>sm()</code> method (generic introduced in the <code>greybox</code> package), the output of which can then be merged with the original model via the <code>implant()</code> method.</p>
<p>For the same model that we used earlier, the scale model can be estimated this way:</p>
<pre class="decode">adamETSBJSM <- sm(adamETSBJ)</pre>
<p>This is how it looks:</p>
<pre class="decode">plot(adamETSBJSM, 7)</pre>
<div id="attachment_3707" style="width: 310px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJSM.png&amp;nocache=1"><img decoding="async" aria-describedby="caption-attachment-3707" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJSM-300x210.png&amp;nocache=1" alt="Scale model for the ADAM ETS" width="300" height="210" class="size-medium wp-image-3707" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJSM-300x210.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJSM-768x538.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJSM.png&amp;nocache=1 1000w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-3707" class="wp-caption-text">Scale model for the ADAM ETS</p></div>
<p>In the plot above, the y-axis contains the squared residuals. The fact that the holdout sample contains a large increase in the error is expected, because that part corresponds to the forecast errors rather than residuals. It is added to the plot for completeness.</p>
<p>To use the scale model in forecasting, we should implant it in the location one, which can be done using the following command:</p>
<pre class="decode">adamETSBJFull <- implant(location=adamETSBJ, scale=adamETSBJSM)</pre>
<p>The resulting model will have fewer degrees of freedom (because the scale model estimated two parameters), but its prediction interval will now take the scale model into account, and will differ from the original. We will now take into account the time varying variance based on the more recent information instead of the averaged one across the whole time series. In our case, the forecasted variance is lower than the one we would obtain in case of the adamETSBJ model. This leads to the narrower prediction interval (you can produce them for both models and compare):</p>
<pre class="decode">forecast(adamETSBJFull, h=10, interval="prediction") |> plot()</pre>
<div id="attachment_3708" style="width: 310px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJFull.png&amp;nocache=1"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3708" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJFull-300x210.png&amp;nocache=1" alt="Forecast from the full ADAM, containing both location and scale parts" width="300" height="210" class="size-medium wp-image-3708" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJFull-300x210.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJFull-768x538.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/10/adamETSBJFull.png&amp;nocache=1 1000w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-3708" class="wp-caption-text">Forecast from the full ADAM, containing both location and scale parts</p></div>
<h3>Conclusions</h3>
<p>The methods discussed above give a bit of flexibility of how to model things and what tools to use. I hope this makes your life easier and that you won't need to spend time reading the source code, but instead can focus on <a href="https://openforecast.org/adam/">forecasting and analytics with ADAM</a>.</p>
<p>Message <a href="https://openforecast.org/2024/10/10/methods-for-the-smooth-functions-in-r/">Methods for the smooth functions in R</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2024/10/10/methods-for-the-smooth-functions-in-r/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The role of M competitions in forecasting</title>
		<link>https://openforecast.org/2024/03/14/the-role-of-m-competitions-in-forecasting/</link>
					<comments>https://openforecast.org/2024/03/14/the-role-of-m-competitions-in-forecasting/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Thu, 14 Mar 2024 14:53:03 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[stories]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3358</guid>

					<description><![CDATA[<p>If you are interested in forecasting, you might have heard of M-competitions. They played a pivotal role in developing forecasting principles, yet also sparked controversy. In this short post, I&#8217;ll briefly explain their historical significance and discuss their main findings. Before M-competitions, only few papers properly evaluated forecasting approaches. Statisticians assumed that if a model [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2024/03/14/the-role-of-m-competitions-in-forecasting/">The role of M competitions in forecasting</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you are interested in forecasting, you might have heard of M-competitions. They played a pivotal role in developing forecasting principles, yet also sparked controversy. In this short post, I&#8217;ll briefly explain their historical significance and discuss their main findings.</p>
<p>Before M-competitions, only few papers properly evaluated forecasting approaches. Statisticians assumed that if a model had solid theoretical backing, it should perform well. One of the first papers to conduct a proper evaluation was <a href="https://doi.org/10.2307/2344546">Newbold &#038; Granger (1974)</a>, who compared exponential smoothing (ES), ARIMA, and stepwise AR on 106 economic time series. Their conclusions were:</p>
<p>1. ES performed well on short time series;<br />
2. Stepwise AR did well on the series with more than 30 observations;<br />
3. Box-Jenkins methodology was recommended for series longer than 50 observations.</p>
<p>Statistical community received the results favourably, as they aligned with their expectations.</p>
<p>In 1979, <a href="https://doi.org/10.2307/2345077">Makridakis &#038; Hibon</a> conducted a similar analysis on 111 time series, including various ES methods and ARIMA. However, they found that &#8220;simpler methods perform well in comparison to the more complex and statistically sophisticated ARMA models&#8221;. This is because ARIMA performed slightly worse than ES, which contradicted the findings of Newbold &#038; Granger. Furthermore, their paper faced heavy criticism, with some claiming that Makridakis did not correctly utilize Box-Jenkins methodology.</p>
<p>So, in 1982, <a href="https://doi.org/10.1002/for.3980010202">Makridakis et al.</a> organized a competition on 1001 time series, inviting external participants to submit their forecasts. It was won by&#8230; the <a href="https://doi.org/10.1002/for.3980010108">ARARMA model by Emmanuel Parzen</a>. This model used information criteria for ARMA order selection instead of Box-Jenkins methodology. The main conclusion drawn from this competition was that &#8220;<strong>Statistically sophisticated or complex methods do not necessarily provide more accurate forecasts than simpler ones</strong>.&#8221; Note that this does not mean that simple methods are always better, because that was not even the case in the first competition: it was won by a quite complicated statistical model based on ARMA. This only means that the complexity does not necessarily translate into accuracy.</p>
<p>The M2 competition focused on judgmental forecasting, and is not discussed here.</p>
<p>We then arrive to <a href="https://doi.org/10.1016/S0169-2070(00)00057-1">M3 competition</a> with 3003 time series and, once again, open submission for anyone. The results widely confirmed the previous findings, with <a href="https://doi.org/10.1016/S0169-2070(00)00066-2">Theta</a> by Vasilious Assimakopoulos and Kostas Nikolopoulos outperforming all the other methods. Note that ARIMA with order selection based on Box-Jenkins methodology performed fine, but could not beat its competitors.</p>
<p>Finally, we arrive to <a href="https://doi.org/10.1016/j.ijforecast.2019.04.014">M4 competition</a>, which had 100,000 time series and was open to even wider audience. While I have <a href="https://openforecast.org/2020/03/01/m-competitions-from-m4-to-m5-reservations-and-expectations/">my reservations about the competition itself</a>, there were several curious findings, including the fact that ARIMA implemented by <a href="https://doi.org/10.18637/jss.v027.i03">Hyndman &#038; Khandakar (2008)</a> performed on average better than ETS (Theta outperformed both of them), and that the more complex methods won the competition.</p>
<p>It was also the first paper to show that the accuracy tends to increase on average with the increase of the computational time spent for training. This means that if you want to have more accurate forecasts, you need to spend more resources. The only catch is that this happens with the decreasing return effect. So, the improvements become smaller and smaller the more time you spend on training.</p>
<p>The competition was followed by M5 and M6, and now they plan to have another one. I don&#8217;t want to discuss all of them &#8211; they are beyond the scope of this short post (see details on the <a href="https://mofc.unic.ac.cy/history-of-competitions/">website of the competitions</a>). But I personally find the first competitions very impactful and useful.</p>
<p>And here are my personal takeaways from these competitions:</p>
<p>1. Simple forecasting methods perform well and should be included as benchmarks in experiments;<br />
2. Complex methods can outperform simple ones, especially if used intelligently, but you might need to spend more resources to gain in accuracy;<br />
3. ARIMA is effective, but Box-Jenkins methodology may not be practical. Using information criteria for order selection is a better approach (as evidenced from ARARMA example and Hydnman &#038; Khandakar implementation).</p>
<p>Finally, I like the following <a href="https://robjhyndman.com/hyndsight/m4comp/">quote from Rob J. Hyndman about the competitions</a> that gives some additional perspective: &#8220;The &#8220;M&#8221; competitions organized by Spyros Makridakis have had an enormous influence on the field of forecasting. They focused attention on what models produced good forecasts, rather than on the mathematical properties of those models&#8221;.</p>
<div id="attachment_3360" style="width: 310px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/03/2024-03-13-M3-competition.png&amp;nocache=1"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3360" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/03/2024-03-13-M3-competition-300x182.png&amp;nocache=1" alt="Table with the results of the M3 competition" width="300" height="182" class="size-medium wp-image-3360" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/03/2024-03-13-M3-competition-300x182.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/03/2024-03-13-M3-competition-768x467.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2024/03/2024-03-13-M3-competition.png&amp;nocache=1 923w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-3360" class="wp-caption-text">Table with the results of the M3 competition</p></div>
<p>Message <a href="https://openforecast.org/2024/03/14/the-role-of-m-competitions-in-forecasting/">The role of M competitions in forecasting</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2024/03/14/the-role-of-m-competitions-in-forecasting/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Story of &#8220;Probabilistic forecasting of hourly emergency department arrivals&#8221;</title>
		<link>https://openforecast.org/2023/05/10/story-of-probabilistic-forecasting-of-hourly-emergency-department-arrivals/</link>
					<comments>https://openforecast.org/2023/05/10/story-of-probabilistic-forecasting-of-hourly-emergency-department-arrivals/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Wed, 10 May 2023 20:47:27 +0000</pubDate>
				<category><![CDATA[adam()]]></category>
		<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Stories]]></category>
		<category><![CDATA[Univariate models]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[papers]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3092</guid>

					<description><![CDATA[<p>The paper Back in 2020, when we were all siting in the COVID lockdown, I had a call with Bahman Rostami-Tabar to discuss one of our projects. He told me that he had an hourly data of an Emergency Department from a hospital in Wales, and suggested writing a paper for a healthcare audience to [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2023/05/10/story-of-probabilistic-forecasting-of-hourly-emergency-department-arrivals/">Story of &#8220;Probabilistic forecasting of hourly emergency department arrivals&#8221;</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="/en/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/">The paper</a></p>
<p>Back in 2020, when we were all siting in the COVID lockdown, I had a call with <a href="https://www.bahmanrt.com/">Bahman Rostami-Tabar</a> to discuss one of our projects. He told me that he had an hourly data of an Emergency Department from a hospital in Wales, and suggested writing a paper for a healthcare audience to show them how forecasting can be done properly in this setting. I noted that we did not have experience in working with high frequency data, and it would be good to have someone with relevant expertise. I knew a guy who worked in energy forecasting, <a href="http://www.jethrobrowell.com/">Jethro Browell</a> (we are mates in the <a href="https://forecasters.org/programs/communities/united-kingdom-chapter/">IIF UK Chapter</a>), so we had a chat between the three of us and formed a team to figure out better ways for ED arrival demand forecasting.</p>
<p>We agreed that each one of us will try their own models. Bahman wanted to try TBATS, Prophet and models from the <a href="https://github.com/tidyverts/fasster">fasster</a> package in R (spoiler: the latter ones produced very poor forecasts on our data, so we removed them from the paper). Jethro had a pool of <a href="https://www.gamlss.com/" rel="noopener" target="_blank">GAMLSS</a> models with different distributions, including Poisson and truncated Normal. He also tried a Gradient Boosting Machine (GBM). I decided to test ETS, Poisson Regression and <a href="https://openforecast.org/adam/" rel="noopener" target="_blank">ADAM</a>. We agreed that we will measure performance of models not only in terms of point forecasts (using RMSE), but also in terms of quantiles (pinball and quantile bias) and computational time. It took us a year to do all the experiments and another one to find a journal that would not desk-reject our paper because the editor thought that it was not relevant (even though they have published similar papers in the past). It was rejected from Annals of Emergency Medicine, Emergency Medicine Journal, American Journal of Emergency Medicine and Journal of Medical Systems. In the end, we submitted to Health Systems, and after a short revision the paper got accepted. So, there is a happy end in this story.</p>
<p>In the paper itself, we found that overall, in terms of quantile bias (calibration of models), GAMLSS with truncated Normal distribution and ADAM performed better than the other approaches, with the former also doing well in terms of pinball loss and the latter doing well in terms of point forecasts (RMSE). Note that the count data models did worse than the continuous ones, although one would expect Poisson distribution to be appropriate for the ED arrivals.</p>
<p>I don&#8217;t want to explain the paper and its findings in detail in this post, but given my relation to ADAM, I have decided to briefly explain what I included in the model and how it was used. After all, this is the first paper that uses almost all the main features of ADAM and shows how powerful it can be if used correctly.</p>
<h3>Using ADAM in Emergency Department arrivals forecasting</h3>
<p><strong>Disclaimer</strong>: The explanation provided here relies on the content of my monograph &#8220;<a href="https://openforecast.org/adam/">Forecasting and Analytics with ADAM</a>&#8220;. In the paper, I ended up creating a quite complicated model that allowed capturing complex demand dynamics. In order to fully understand what I am discussing in this post, you might need to refer to the monograph.</p>
<div id="attachment_3117" style="width: 1210px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data.png&amp;nocache=1"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3117" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data.png&amp;nocache=1" alt="Emergency Department Arrivals" width="1200" height="800" class="size-full wp-image-3117" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data.png&amp;nocache=1 1200w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-300x200.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-1024x683.png&amp;nocache=1 1024w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-768x512.png&amp;nocache=1 768w" sizes="auto, (max-width: 1200px) 100vw, 1200px" /></a><p id="caption-attachment-3117" class="wp-caption-text">Emergency Department Arrivals. The plots were generated using <code>seasplot()</code> function from the <code>tsutils</code> package.</p></div>
<p>The figure above shows the data that we were dealing with together with several seasonal plots (generated using <code>seasplot()</code> function from the <code>tsutils</code> package). As we see, the data exhibits hour of day, day of week and week of year seasonalities, although some of them are not very well pronounced. The data does not seem to have a strong trend, although there is a slow increase of the level. Based on this, I decided to use ETS(M,N,M) as the basis for modelling. However, if we want to capture all three seasonal patterns then we need to fit a triple seasonal model, which requires too much computational time, because of the estimation of all the seasonal indices. So, I have decided to use a <a href="https://openforecast.org/adam/ADAMMultipleFrequencies.html">double-seasonal ETS(M,N,M)</a> instead with hour of day and hour of week seasonalities and to include <a href="https://openforecast.org/adam/ETSXMultipleSeasonality.html">dummy variables for week of year seasonality</a>. The alternative to week of year dummies would be hour of year seasonal component, which would then require estimating 8760 seasonal indices, potentially overfitting the data. I argue that the week of year dummy provides the sufficient flexibility and there is no need in capturing the detailed intra-yearly profile on a more granular level.</p>
<p>To make things more exciting, given that we deal with hourly data of a UK hospital, we had to deal with issues of <a href="https://openforecast.org/adam/MultipleFrequenciesDSTandLeap.html">daylight saving and leap year</a>. I know that many of us hate the idea of daylight saving, because we have to change our lifestyles 2 times each year just because of an old 18th century tradition. But in addition to being <a href="https://publichealth.jhu.edu/2023/7-things-to-know-about-daylight-saving-time#:~:text=Making%20the%20shift%20can%20increase,a%20professor%20in%20Mental%20Health.">bad for your health</a>, this nasty thing messes things up for my models, because once a year we have 23 hours and in another time we have 25 hours in a day. Luckily, it is taken care of by <code>adam()</code> that shifts seasonal indices, when the time change happens. All you need to do for this mechanism to work is to provide an object with timestamps to the function (for example, zoo). As for the leap year, it becomes less important when we model week of year seasonality instead of the day of year or hour of year one.</p>
<div id="attachment_3123" style="width: 1210px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-daily.png&amp;nocache=1"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3123" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-daily.png&amp;nocache=1" alt="Emergency Department Daily Arrivals" width="1200" height="700" class="size-full wp-image-3123" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-daily.png&amp;nocache=1 1200w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-daily-300x175.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-daily-1024x597.png&amp;nocache=1 1024w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/05/EDArrivals-data-daily-768x448.png&amp;nocache=1 768w" sizes="auto, (max-width: 1200px) 100vw, 1200px" /></a><p id="caption-attachment-3123" class="wp-caption-text">Emergency Department Daily Arrivals</p></div>
<p>Furthermore, as it can be seen from the figure above, it is apparent that <a href="https://openforecast.org/adam/ADAMX.html">calendar events</a> play a crucial role in ED arrivals. For example, the Emergency Department demand over Christmas is typically lower than average (the drops in Figure above), but right after the Christmas it tends to go up (with all the people who injured themselves during the festivities showing up in the hospital). So these events need to be taken into account in a form of additional dummy variables by a model together with their lags (the 24 hour lags of the original variables).</p>
<p>But that&#8217;s not all. If we want to fit a multiplicative seasonal model (which makes more sense than the additive one due to changing seasonal amplitude for different times of year), we need to do something with zeroes, which happen naturally in ED arrivals over night (see the first figure in this post with seasonal plots). They do not necessarily happen at the same time of day, but the probability of having no demand tends to increase at night. This meant that I needed to introduce the <a href="https://openforecast.org/adam/ADAMIntermittent.html">occurrence part of the model</a> to take care of zeroes. I used a very basic occurrence model called &#8220;<a href="https://openforecast.org/adam/ADAMOccurrence.html#oETSD">direct probability</a>&#8220;, because it is more sensitive to changes in demand occurrence, making the model more responsive. I did not use a seasonal demand occurrence model (and I don&#8217;t remember why), which is one of the limitations of ADAM used in this study.</p>
<p>Finally, given that we are dealing with low volume data, a positive distribution needed to be used instead of the Normal one. I used <a href="https://openforecast.org/adam/ADAMETSMultiplicativeDistributions.html">Gamma distribution</a> because it is better behaved than the Log Normal or the Inverse Gaussian, which tend to have much heavier tails. In the exploration of the data, I found that Gamma does better than the other two, probably because the ED arrivals have relatively slim tails.</p>
<p>So, the final ADAM included the following features:</p>
<ul>
<li>ETS(M,N,M) as the basis;</li>
<li>Double seasonality;</li>
<li>Week of year dummy variables;</li>
<li>Dummy variables for calendar events with their lags;</li>
<li>&#8220;Direct probability&#8221; occurrence model;</li>
<li>Gamma distribution for the residuals of the model.</li>
</ul>
<p>This model is summarised in equation (3) of <a href="/en/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/">the paper</a>.</p>
<p>The model was <a href="https://openforecast.org/adam/ADAMInitialisation.html">initialised using backcasting</a>, because otherwise we would need to estimate too many initial values for the state vector. The estimation itself was done using <a href="https://openforecast.org/adam/ADAMETSEstimationLikelihood.html">likelihood</a>. In R, this corresponded to roughly the following lines of code:</p>
<pre class="decode">library(smooth)
oesModel <- oes(y, "MNN", occurrence="direct", h=48)
adamModelFirst <- adam(ourData, "MNM", lags=c(24,24*7), formula=y~x+xLag24+weekOfYear,
                       h=48, initial="backcasting",
                       occurrence=oesModel, distribution="dgamma")</pre>
<p>Where <code>x</code> was the categorical variable (factor in R) with all the main calendar events. However, even with backcasting, the estimation of such a big model took an hour and 25 minutes. Given that Bahman, Jethro and I have agreed to do rolling origin evaluation, I've decided to help the function in the estimation inside the loop, providing <a href="https://openforecast.org/adam/ADAMInitialisation.html#starting-optimisation-of-parameters">the initials to the optimiser</a> based on the very first estimated model. As a result, each estimation of ADAM in the rolling origin took 1.5 minutes. The code in the loop was modified to:</p>
<pre class="decode">adamParameters <- coef(adamModelFirst)
oesModel <- oes(y, "MNN", occurrence="direct", h=48)
adamModel <- adam(ourData, "MNM", lags=c(24,24*7), formula=y~x+xLag24+weekOfYear,
                  h=48, initial="backcasting",
                  occurrence=oesModel, distribution="dgamma",
                  B=adamParameters)</pre>
<p>Finally, we generated mean and quantile forecasts for 48 hours ahead. I used <a href="https://openforecast.org/adam/ADAMForecastingPI.html#semiparametric-intervals">semiparametric quantiles</a>, because I expected violation of some of assumptions in the model (e.g. autocorrelated residuals). The respective R code is:</p>
<pre class="decode">testForecast <- forecast(adamModel, newdata=newdata, h=48,
                         interval="semiparametric", level=c(1:19/20), side="upper")</pre>
<p>Furthermore, given that the data is integer-valued (how many people visit the hospital each hour) and ADAM produces fractional quantiles (because of the Gamma distribution), I decided to see how it would perform if the quantiles were rounded up. This strategy is simple and might be sensible when a continuous model is used for forecasting on a count data (see discussion in the paper). However, after running the experiment, the ADAM with rounded up quantiles performed very similar to the conventional one, so we have decided not to include it in the paper.</p>
<p>In the end, as stated earlier in this post, we concluded that in our experiment, there were two well performing approaches: GAMLSS with Truncated Normal distribution (called "NOtr-2" in the paper) and ADAM in the form explained above. The popular TBATS, Prophet and Gradient Boosting Machine performed poorly compared to these two approaches. For the first two, this is because of the lack of explanatory variables and inappropriate distributional assumptions (normality). As for the GBM, this is probably due to the lack of dynamic element in it (e.g. changing level and seasonal components).</p>
<p>Concluding this post, as you can see, I managed to fit a decent model based on ADAM, which captured the main characteristics of the data. However, it took a bit of time to understand what features should be included, together with some experiments on the data. This case study shows that if you want to get a better model for your problem, you might need to dive in the problem and spend some time analysing what you have on hands, experimenting with different parameters of a model. ADAM provides the flexibility necessary for such experiments.</p>
<p>Message <a href="https://openforecast.org/2023/05/10/story-of-probabilistic-forecasting-of-hourly-emergency-department-arrivals/">Story of &#8220;Probabilistic forecasting of hourly emergency department arrivals&#8221;</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2023/05/10/story-of-probabilistic-forecasting-of-hourly-emergency-department-arrivals/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Probabilistic forecasting of hourly emergency department arrivals</title>
		<link>https://openforecast.org/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/</link>
					<comments>https://openforecast.org/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Tue, 09 May 2023 06:45:13 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[Papers]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<category><![CDATA[papers]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3090</guid>

					<description><![CDATA[<p>Authors: Bahman Rostami-Tabar, Jethro Browell, Ivan Svetunkov Journal: Health Systems Abstract: An accurate forecast of Emergency Department (ED) arrivals by an hour of the day is critical to meet patients’ demand. It enables planners to match ED staff to the number of arrivals, redeploy staff, and reconfigure units. In this study, we develop a model [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/">Probabilistic forecasting of hourly emergency department arrivals</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Authors</strong>: <a href="https://www.bahmanrt.com/">Bahman Rostami-Tabar</a>, <a href="http://www.jethrobrowell.com/">Jethro Browell</a>, Ivan Svetunkov</p>
<p><strong>Journal</strong>: Health Systems</p>
<p><strong>Abstract</strong>: An accurate forecast of Emergency Department (ED) arrivals by an hour of the day is critical to meet patients’ demand. It enables planners to match ED staff to the number of arrivals, redeploy staff, and reconfigure units. In this study, we develop a model based on Generalised Additive Models and an advanced dynamic model based on exponential smoothing to generate an hourly probabilistic forecast of ED arrivals for a prediction window of 48 hours. We compare the forecast accuracy of these models against appropriate benchmarks, including TBATS, Poisson Regression, Prophet, and simple empirical distribution. We use Root Mean Squared Error to examine the point forecast accuracy and assess the forecast distribution accuracy using Quantile Bias, PinBall Score and Pinball Skill Score. Our results indicate that the proposed models outperform their benchmarks. Our developed models can also be generalised to other services, such as hospitals, ambulances or clinical desk services.</p>
<p>DOI: <a href="https://doi.org/10.1080/20476965.2023.2200526" rel="noopener" target="_blank">10.1080/20476965.2023.2200526</a></p>
<p><a href="https://zenodo.org/record/7874721" rel="noopener" target="_blank">The paper and R code</a>.</p>
<p><a href="/en/2023/05/10/story-of-probabilistic-forecasting-of-hourly-emergency-department-arrivals/">Story of the paper</a>.</p>
<p>Message <a href="https://openforecast.org/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/">Probabilistic forecasting of hourly emergency department arrivals</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2023/05/09/probabilistic-forecasting-of-hourly-emergency-department-arrivals/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Error Measures Flow Chart</title>
		<link>https://openforecast.org/2021/07/20/error-measures-flow-chart/</link>
					<comments>https://openforecast.org/2021/07/20/error-measures-flow-chart/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Tue, 20 Jul 2021 18:03:05 +0000</pubDate>
				<category><![CDATA[Applied forecasting]]></category>
		<category><![CDATA[Forecast evaluation]]></category>
		<category><![CDATA[Theory of forecasting]]></category>
		<category><![CDATA[error measures]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=2678</guid>

					<description><![CDATA[<p>In order to help master students of Lancaster University Managemen Science department, I have developed a flow chart, that acts as a basic guide on what error measures to use in different circumstances. This is not a complete and far from perfect flow chart, and it assumes that the decision maker knows what intermittent demand [&#8230;]</p>
<p>Message <a href="https://openforecast.org/2021/07/20/error-measures-flow-chart/">Error Measures Flow Chart</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In order to help master students of Lancaster University Managemen Science department, I have developed a flow chart, that acts as a basic guide on what error measures to use in different circumstances. This is not a complete and far from perfect flow chart, and it assumes that the decision maker knows what intermittent demand is and what stationarity means. Nonetheless, it can be used for initial decision on what to use. All the error measures are explained in <a href="https://openforecast.org/adam/forecastsEvaluation.html" rel="noopener" target="_blank">the ADAM textbook</a>. Here is the flow chart (click to zoom in):</p>
<div id="attachment_2685" style="width: 217px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-scaled.gif"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2685" src="https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-207x300.gif" alt="Error measures flow chart" width="207" height="300" class="size-medium wp-image-2685" srcset="https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-207x300.gif 207w, https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-706x1024.gif 706w, https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-768x1114.gif 768w, https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-1059x1536.gif 1059w, https://openforecast.org/wp-content/uploads/2021/07/errorMeasuresFlowChart-1-1412x2048.gif 1412w" sizes="auto, (max-width: 207px) 100vw, 207px" /></a><p id="caption-attachment-2685" class="wp-caption-text">Error measures flow chart</p></div>
<p>And here is the <a href="https://openforecast.org/wp-content/uploads/2021/07/Svetunkov-2021-Error-Measures-Flow-Chart.pdf">pdf version</a> of it. Enjoy!</p>
<p>Message <a href="https://openforecast.org/2021/07/20/error-measures-flow-chart/">Error Measures Flow Chart</a> first appeared on <a href="https://openforecast.org">Open Forecasting</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2021/07/20/error-measures-flow-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
