<?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 ARIMA - OpenForecast</title>
	<atom:link href="https://openforecast.org/category/univariate-en/arima-en/feed/" rel="self" type="application/rss+xml" />
	<link>https://openforecast.org/category/univariate-en/arima-en/</link>
	<description>How to look into the future</description>
	<lastBuildDate>Sat, 26 Sep 2026 09:05:08 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2026/07/cropped-of-logo-short-1-32x32.png&amp;nocache=1</url>
	<title>Archives ARIMA - OpenForecast</title>
	<link>https://openforecast.org/category/univariate-en/arima-en/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>smooth for Python: Automatic order selection for MSARIMA</title>
		<link>https://openforecast.org/2026/09/28/smooth-for-python-automatic-order-selection-for-msarima/</link>
					<comments>https://openforecast.org/2026/09/28/smooth-for-python-automatic-order-selection-for-msarima/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Mon, 28 Sep 2026 08:00:04 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[smooth for Python]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[smooth]]></category>
		<category><![CDATA[theory]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=4654</guid>

					<description><![CDATA[<p>Have you ever tried to identify ARIMA for your data? The old school Box-Jenkins methodology implies analysing ACF/PACF plots and selecting the orders iteratively. This approach has a fundamental flaw I discussed in one of my earlier posts. Brute force does not help either: even p ≤ 3, d ≤ 2, q ≤ 3 gives ... <a title="smooth for Python: Automatic order selection for MSARIMA" class="read-more" href="https://openforecast.org/2026/09/28/smooth-for-python-automatic-order-selection-for-msarima/" aria-label="Read more about smooth for Python: Automatic order selection for MSARIMA">Read more</a></p>
<p>Message <a href="https://openforecast.org/2026/09/28/smooth-for-python-automatic-order-selection-for-msarima/">smooth for Python: Automatic order selection for MSARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Have you ever tried to identify ARIMA for your data? The old school Box-Jenkins methodology implies analysing ACF/PACF plots and selecting the orders iteratively. This approach has a fundamental flaw I discussed in one of <a href="/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/">my earlier posts</a>. Brute force does not help either: even p ≤ 3, d ≤ 2, q ≤ 3 gives 48 candidates, and seasonal lags push it into the thousands. So, smart people came up with great heuristics that allow identifying the orders in a short period of time. Let me explain.</p>
<p>One of the widely used approaches was developed by <a href="https://doi.org/10.18637/jss.v027.i03">Hyndman &#038; Khandakar (2008)</a>. It is implemented in auto.arima in R (and in StatsForecast for Python). It mixes two frameworks: stationarity tests (KPSS or ADF) to select the order of differencing d, and then information criteria for p and q. The tests are needed because, in the conventional formulation, models with different d are estimated on different sample sizes, so their information criteria cannot be compared (I explained <a href="/2026/09/12/on-differencing-of-arima-in-state-space/">this here</a>). Although the algorithm works well and showed good performance in several competitions, it mixes hypothesis testing with information theory. The former tests the differences between samples, but assumes that you can make a mistake (based on your significance level), while the latter simply selects the most plausible model given data.</p>
<p>AutoMSARIMA does the selection differently. Because it is formulated in state space, the sample stays the same for any d, so the algorithm can compare all orders directly via information criteria, including the differencing. This follows the approach of <a href="https://doi.org/10.1080/00207543.2019.1600764">Svetunkov &#038; Boylan (2020)</a>, which treats order selection as a component selection problem rather than hypothesis testing. No ADF test, no KPSS test, no pre-screening for stationarity. The IC decides everything. And because nothing in this logic is tied to a specific seasonal period, it extends naturally to multiple seasonalities: each seasonal lag simply adds its own components to the model, and the same criterion decides which of them to keep, with the seasonality remaining stochastic rather than fixed.</p>
<p>The search itself is stepwise: the algorithm inspects the ACF/PACF of the residuals to propose a candidate order, adds it, and keeps it only if the information criterion decreases. When done, it also tries several simple SARIMA models to check whether any of them beats the selected one. The algorithm is explained <a href="/adam/ARIMASelection.html">in detail here</a>.</p>
<p>In Python:</p>
<pre class="decode">from fcompdata import AirPassengers
from smooth import AutoMSARIMA

# Monthly data, automatic order selection up to SARIMA(3,2,3)(3,1,3)[12]
model = AutoMSARIMA(lags=[1, 12])
model.fit(AirPassengers.y)
print(model)</pre>
<p>The same algorithm works for the multiple seasonal ARIMA. The only thing to specify explicitly is the maximum orders to check:</p>
<pre class="decode">from fcompdata import taylor

model = AutoMSARIMA(
lags=[1, 48, 336],
orders={"ar": [3, 2, 2],
"i": [2, 1, 1],
"ma": [3, 2, 2]}
)
model.fit(taylor.y)</pre>
<p>The selected model returns the same attributes and supports the same methods as ADAM.</p>
<p>Does it actually work? I benchmarked AutoMSARIMA against statsforecast AutoARIMA, skforecast and R&#8217;s auto.arima on 5,315 series from the M1, M3 and Tourism datasets. The honest summary: point accuracy is a tie &#8211; RMSSE differs in the third decimal place across all implementations. But smooth produces the best-calibrated prediction intervals of the pack and is 3–5 times faster than the alternatives. <a href="https://github.com/openforecast-org/smooth/blob/master/python/tests/notebooks/2026-09-21-smooth-1-0-8-benchmark_auto_arima.ipynb">Here is the full notebook</a>.</p>
<p>Try smooth now: <code>pip install smooth</code><br />
<a href="https://github.com/openforecast-org/smooth/wiki">smooth wiki</a>.</p>
<p>Message <a href="https://openforecast.org/2026/09/28/smooth-for-python-automatic-order-selection-for-msarima/">smooth for Python: Automatic order selection for MSARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2026/09/28/smooth-for-python-automatic-order-selection-for-msarima/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>smooth for Python: ETS+ARIMA</title>
		<link>https://openforecast.org/2026/09/17/smooth-for-python-ets-arima/</link>
					<comments>https://openforecast.org/2026/09/17/smooth-for-python-ets-arima/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Thu, 17 Sep 2026 09:05:42 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[smooth for Python]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[smooth]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=4621</guid>

					<description><![CDATA[<p>ETS is powerful. ARIMA is powerful. But when you need both, you are typically left with fitting ARMA to the residuals of ETS, which biases the parameters. There is a much neater solution: combine them in one state space model to estimate everything jointly&#8230; The standard practice when ETS is not enough to capture the ... <a title="smooth for Python: ETS+ARIMA" class="read-more" href="https://openforecast.org/2026/09/17/smooth-for-python-ets-arima/" aria-label="Read more about smooth for Python: ETS+ARIMA">Read more</a></p>
<p>Message <a href="https://openforecast.org/2026/09/17/smooth-for-python-ets-arima/">smooth for Python: ETS+ARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="/2026/04/22/smooth-in-python-ets-with-model-selection/">ETS is powerful</a>. ARIMA is powerful. But when you need both, you are typically left with fitting ARMA to the residuals of ETS, which biases the parameters. There is a much neater solution: combine them in one state space model to estimate everything jointly&#8230;</p>
<p>The standard practice when ETS is not enough to capture the dynamics of real demand is to either switch to ARIMA or apply it to the residuals of the model. But it is possible to join the two models in one by using the Single Source of Error (SSOE) state space framework and to estimate the parameters jointly. This reduces the bias in the parameter estimates, letting the two models work as a team rather than one cleaning up after the other.</p>
<p>In the SSOE form, ETS and ARIMA states are stacked one after another in a large vector. For example, an ETS(A,N,A)+AR(2) model has four states: level, seasonal, and two AR components — each updated independently but responding to the same shock. Structurally, this resembles fitting ETS and then modelling its residuals with ARIMA, but with a critical difference: the parameters are estimated jointly, removing the bias that accumulates from sequential fitting.</p>
<p>But this flexibility comes with constraints. Some ETS and ARIMA combinations are actually redundant — they describe the same process from two angles, producing infinitely many parameter combinations with identical fit. For example, ETS(A,N,N) and ARIMA(0,1,1) are equivalent models, and combining them creates an unidentifiable model with no stable solution. So, I have come up with a few practical guidelines, which you can read about in <a href="/adam/ETSAndARIMA.html">Section 9.4 of ADAM</a>.</p>
<p>Practically speaking, this is all handled under the hood of the ADAM function in Python, so you don&#8217;t need to worry about it. Here is an example:</p>
<pre class="decode">from fcompdata import AirPassengers
from smooth import ADAM

# ETS(A,A,N) + SARIMA(0,0,0)(1,1,1)[12]
model = ADAM(
    model="AAN",
    ar_order=[0, 1],
    i_order=[0, 1],
    ma_order=[0, 1],
    lags=[1, 12],
    h=12, holdout=True
)
model.fit(AirPassengers.y)</pre>
<p>Note how the orders are specified: per lag, with the first element referring to lag 1 and the second to lag 12. The code above fits ETS(A,A,N) + SARIMA(0,0,0)(1,1,1)[12], delegating the seasonality to the ARIMA part. The advantage of doing this via ADAM is that the result can be compared with pure ETS or ARIMA directly using information criteria. And if you don&#8217;t want to choose the orders yourself, AutoADAM will select them for you.</p>
<p>But do you even need the full combination? <a href="https://doi.org/10.1002/for.3980040103">Gardner (1985)</a> and <a href="https://doi.org/10.1016/j.ejor.2009.10.003">Taylor (2010)</a> argued that adding AR(1) tends to improve the accuracy of ETS. So, maybe you can get away with the simple ETS+AR(1) model, which is easy to apply using ADAM.</p>
<p><a href="/adam/ARIMAandETS.html">When to use ETS vs ARIMA</a>.<br />
<a href="/adam/ETSAndARIMA.html">How to combine them</a>.</p>
<p>Try it yourself: <code>pip install smooth</code></p>
<p>Message <a href="https://openforecast.org/2026/09/17/smooth-for-python-ets-arima/">smooth for Python: ETS+ARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2026/09/17/smooth-for-python-ets-arima/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>On differencing of ARIMA in state space</title>
		<link>https://openforecast.org/2026/09/12/on-differencing-of-arima-in-state-space/</link>
					<comments>https://openforecast.org/2026/09/12/on-differencing-of-arima-in-state-space/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Sat, 12 Sep 2026 11:25:01 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[smooth for Python]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<category><![CDATA[theory]]></category>
		<category><![CDATA[time series]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=4641</guid>

					<description><![CDATA[<p>A reader left a comment under the MSARIMA post on LinkedIn saying that in order to compare ARIMAs via information criteria, we need to make sure that the candidate models have the same order of differencing. They are right — for the conventional ARIMA. BUT! In the state space formulation, the problem disappears. Here is ... <a title="On differencing of ARIMA in state space" class="read-more" href="https://openforecast.org/2026/09/12/on-differencing-of-arima-in-state-space/" aria-label="Read more about On differencing of ARIMA in state space">Read more</a></p>
<p>Message <a href="https://openforecast.org/2026/09/12/on-differencing-of-arima-in-state-space/">On differencing of ARIMA in state space</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A reader left a comment under the <a href="https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/">MSARIMA post</a> on LinkedIn saying that in order to compare ARIMAs via information criteria, we need to make sure that the candidate models have the same order of differencing. They are right — for the conventional ARIMA. BUT! In the state space formulation, the problem disappears. Here is why.</p>
<p>In the conventional ARIMA, taking differences is treated as a pre-processing step, where we switch from, for example, the sales of a product to the sales increase/decrease. If you had a sample of 100 observations, after first differences you are left with 99 &#8211; the first observation has nothing to be subtracted from. So yes, with the conventional approach, ARIMA(1,0,1) and ARIMA(1,1,1) are estimated on different sample sizes, and their information criteria are not directly comparable.</p>
<p>But! MSARIMA (and ADAM in general) is a state space model, and this pre-processing step is not needed. The differences are embedded in the model as additional components: ARIMA(0,1,1) has one, ARIMA(0,2,1) has two. The sample stays the same; what changes is the number of estimated parameters &#8211; each new component needs its initial value, and the information criterion penalises that. So the comparison stays fair: same sample, same likelihood basis, different number of parameters. I have <a href="/adam/StateSpaceARIMA.html#ADAMARIMAExamplesModels">several examples of how ARIMA is formulated in the ADAM SSOE framework</a>.</p>
<p>What this implies: any ARIMA model of any orders (non-seasonal, seasonal, or multiseasonal) can be compared with other ARIMA models directly via information criteria, on the same sample of data.</p>
<p>This is not a new idea, by the way. I used this approach in the ARIMA algorithm I developed for the DemandWorks company (now part of Netstock) more than ten years ago, and John Boylan and I later built the State Space ARIMA on the same principle (<a href="https://doi.org/10.1080/00207543.2019.1600764">the paper</a>).</p>
<p>So, yes: if you use the conventional ARIMA (auto_arima from pmdarima, ARIMA from aeon or statsforecast in Python; stats or forecast implementations in R), you NEED to make sure that you compare models with the same order of differencing. But if you use the smooth implementation, you don&#8217;t need to worry &#8211; everything is already taken care of for you. This comes as a bonus from the specific formulation of the model.</p>
<p>Message <a href="https://openforecast.org/2026/09/12/on-differencing-of-arima-in-state-space/">On differencing of ARIMA in state space</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2026/09/12/on-differencing-of-arima-in-state-space/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>smooth in python: Multiple Seasonal ARIMA</title>
		<link>https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/</link>
					<comments>https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Thu, 10 Sep 2026 08:01:44 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[smooth for Python]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[Seasonality]]></category>
		<category><![CDATA[smooth]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=4632</guid>

					<description><![CDATA[<p>ARIMA has been a workhorse for decades. But the standard implementations quietly hard-code assumptions: one seasonal cycle, Gaussian errors, regressors handled separately etc. This is fine for textbook well-behaved data. But what do you do when you face real data? The conventional implementations (statsmodels or pmdarima in Python, stats in R) do their job well: ... <a title="smooth in python: Multiple Seasonal ARIMA" class="read-more" href="https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/" aria-label="Read more about smooth in python: Multiple Seasonal ARIMA">Read more</a></p>
<p>Message <a href="https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/">smooth in python: Multiple Seasonal ARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>ARIMA has been a workhorse for decades. But the standard implementations quietly hard-code assumptions: one seasonal cycle, Gaussian errors, regressors handled separately etc. This is fine for textbook well-behaved data. But what do you do when you face real data?</p>
<p>The conventional implementations (statsmodels or pmdarima in Python, stats in R) do their job well: they estimate SARIMA via likelihood, select orders automatically, and produce sensible forecasts for series with trend and one seasonality. Monthly or quarterly demand data is their home ground. The problems start when the data has more than one cycle: the classical SARIMA formulation has a slot for exactly one seasonal lag, so for the half-hourly electricity demand you would have to pick either the hour-of-day or the day-of-week cycle and discard the other.</p>
<p>MSARIMA (Multiple Seasonal ARIMA) solves this by reformulating ARIMA in the Single Source of Error (SSOE) state space form. Each AR, I, and MA element becomes a state in the model, so nothing restricts you to one seasonal lag: you can have as many as you want. In the smooth package, orders are specified per lag, matched to a lags list. Here is an example on the classical taylor series (half-hourly electricity demand in England and Wales), with two seasonal cycles:</p>
<p><code>from fcompdata import taylor<br />
from smooth import MSARIMA</p>
<p># MSARIMA(3,0,1)(0,1,1)[48](0,1,1)[336]
model = MSARIMA(<br />
    orders={"ar": [3, 0, 0], "i": [0, 1, 1], "ma": [1, 1, 1]},<br />
    lags=[1, 48, 336],<br />
    h=336, holdout=True<br />
)<br />
model.fit(taylor.y)<br />
model.predict(h=336, interval="prediction", level=0.95)</code></p>
<p>In Python, it takes only 1.5 seconds for the function to fit the model to the data and estimate its parameters, which is fast for a double-seasonal model fit to roughly four thousand observations:</p>
<figure id="attachment_4634" aria-describedby="caption-attachment-4634" style="width: 290px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2026/09/2026-04-30-smooth-posts-07-msarima.png&amp;nocache=1"><img fetchpriority="high" decoding="async" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2026/09/2026-04-30-smooth-posts-07-msarima-300x207.png&amp;nocache=1" alt="Python/R output of the double seasonal ARIMA" width="300" height="207" class="size-medium wp-image-4634" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2026/09/2026-04-30-smooth-posts-07-msarima-300x207.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2026/09/2026-04-30-smooth-posts-07-msarima.png&amp;nocache=1 632w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-4634" class="wp-caption-text">Python/R output of the double seasonal ARIMA</figcaption></figure>
<p>But the smooth implementation brings several additional practical benefits.</p>
<p>First, model.fit() accepts a matrix of external regressors via xreg, estimated jointly with the ARIMA components &#8211; no separate pre-filtering step. The logic and the code are identical to ETSX, <a href="/2026/05/05/smooth-in-python-ets-with-explanatory-variables/">which I covered earlier</a>.</p>
<p>Second, you can swap the loss: loss=&#8221;GTMSE&#8221; or &#8220;MSEh&#8221; optimises the model directly on multistep errors, with the same shrinkage mechanism I discussed in <a href="/2026/08/31/smooth-in-python-multistep-losses/">the post on multistep losses</a>.</p>
<p>Third, you don&#8217;t need to stick with the Gaussian distribution &#8211; you can choose other ones if you think that, for example, Laplace is more suitable for the data (<a href="/2026/05/27/smooth-in-python-non-normal-distributions-in-ets-arima/">this post</a>).</p>
<p>And there is one more thing. Because MSARIMA now lives in the same state space framework as ETS, the two models can be combined into one and compared with each other directly via information criteria. But that deserves a post of its own, so stay tuned.</p>
<p>Read <a href="/adam/ADAMARIMA.html">Chapter 9 on ADAM ARIMA</a>.<br />
Or check out the documentation in <a href="https://github.com/openforecast-org/smooth/wiki/MSARIMA">smooth wiki</a>.</p>
<p>An why not try it yourself? <code>pip install smooth</code></p>
<p>Message <a href="https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/">smooth in python: Multiple Seasonal ARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2026/09/10/smooth-in-python-multiple-seasonal-arima/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fundamental Flaw of the Box-Jenkins Methodology</title>
		<link>https://openforecast.org/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/</link>
					<comments>https://openforecast.org/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Tue, 13 May 2025 11:57:07 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[Univariate models]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<category><![CDATA[Information criteria]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3838</guid>

					<description><![CDATA[<p>If you have taken a course on forecasting or time series analysis, you’ve probably heard of ARIMA and the Box–Jenkins methodology. In my opinion, this methodology has a fundamental flaw and should not be used in practice. Here&#8217;s why. When Box and Jenkins wrote their book back in the 1960s, it was a very different ... <a title="Fundamental Flaw of the Box-Jenkins Methodology" class="read-more" href="https://openforecast.org/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/" aria-label="Read more about Fundamental Flaw of the Box-Jenkins Methodology">Read more</a></p>
<p>Message <a href="https://openforecast.org/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/">Fundamental Flaw of the Box-Jenkins Methodology</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you have taken a course on forecasting or time series analysis, you’ve probably heard of ARIMA and the Box–Jenkins methodology. In my opinion, <strong>this methodology has a fundamental flaw</strong> and should not be used in practice. Here&#8217;s why.</p>
<p>When Box and Jenkins wrote their book back in the 1960s, it was a very different era: computers were massive, and people worked with punch cards. To make their approach viable, Box and Jenkins developed a methodology for selecting the appropriate orders of AR and MA based on the values of the autocorrelation and partial autocorrelation functions (ACF and PACF, respectively). Their idea was that if an ARMA process generates a specific ACF/PACF pattern, then it could be identified by analysing those functions in the data. At the time, it wasn’t feasible to do cross-validation or rolling origin evaluation, and even using information criteria for model selection was a challenge. So, the Box–Jenkins approach was a sensible option, producing adequate results with limited computational resources, and was considered state of the art.</p>
<p>Unfortunately, as the M1 competition later showed (see my <a href="/2024/03/14/the-role-of-m-competitions-in-forecasting/">earlier post</a>), the methodology didn’t work well in practice. Simpler methods that didn’t rely on rigorous model selection actually performed better. But in fact, the winning model in the competition was ARARMA by Emanuel Parzen (https://doi.org/10.1002/for.3980010108). His idea was to make the series stationary by applying a low-order, non-stationary AR to the data, then extract residuals and select appropriate ARMA orders using AIC. Parzen ignored the Box–Jenkins methodology entirely &#8211; he didn’t analyse ACF or PACF and instead relied fully on automated selection. And it worked!</p>
<p>So why didn’t the Box–Jenkins methodology perform as expected? In my monograph <a href="/adam">Forecasting and Analytics with ADAM</a>, I use the following example to explain the main issue: “All birds have wings. Sarah has wings. Thus, Sarah is a bird.” But Sarah, as shown in the image attached to this post, is a butterfly.</p>
<p>The fundamental issue with the Box–Jenkins methodology lies in its logic: if a process generates a specific ACF/PACF, that doesn’t mean that an observed ACF/PACF must come from that process. Many ARMA and even non-ARMA processes can generate exactly the same autocorrelation structure.</p>
<p>Further developments in ARIMA modelling have shown that ACF and PACF can only be used as general guidelines for order selection. To assess model performance properly, we need other tools. All modern approaches rely on information criteria for ARIMA order selection, and they consistently perform well in forecasting competitions. For example, <a href="https://doi.org/10.18637/jss.v027.i03">Hyndman &#038; Khandakar (2008)</a> use AIC for ARMA order selection, while <a href="https://doi.org/10.1080/00207543.2019.1600764">Svetunkov &#038; Boylan (2020)</a> apply AIC after reformulating ARIMA in a state space form. The former is implemented in the forecast package in R and the StatsForecast library in Python (thanks to Nixtla and Azul Garza); the latter is available in the smooth package in R. I also discuss another ARIMA order selection approach in <a href="/adam/ARIMASelection.html">Section 15.2 of my book</a>.</p>
<p>Long story short: don’t use the Box–Jenkins methodology for order selection. Use more modern tools, such as information criteria.</p>
<p>P.S. <a href="/2024/03/21/what-s-wrong-with-arima/">See also my early post on ARIMA</a>, discussing what is wrong with it.</p>
<p>Message <a href="https://openforecast.org/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/">Fundamental Flaw of the Box-Jenkins Methodology</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2025/05/13/fundamental-flaw-of-the-box-jenkins-methodology/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Detecting patterns in white noise</title>
		<link>https://openforecast.org/2024/04/10/detecting-patterns-in-white-noise/</link>
					<comments>https://openforecast.org/2024/04/10/detecting-patterns-in-white-noise/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Wed, 10 Apr 2024 08:16:58 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[smooth]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3413</guid>

					<description><![CDATA[<p>Back in 2015, when I was working on my paper on Complex Exponential Smoothing, I conducted a simple simulation experiment to check how ARIMA and ETS select components/orders in time series. And I found something interesting&#8230; One of the important steps in forecasting with statistical models is identifying the existing structure. In the case of ... <a title="Detecting patterns in white noise" class="read-more" href="https://openforecast.org/2024/04/10/detecting-patterns-in-white-noise/" aria-label="Read more about Detecting patterns in white noise">Read more</a></p>
<p>Message <a href="https://openforecast.org/2024/04/10/detecting-patterns-in-white-noise/">Detecting patterns in white noise</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Back in 2015, when I was working on my paper on <a href="/2022/08/02/complex-exponential-smoothing/">Complex Exponential Smoothing</a>, I conducted a simple simulation experiment to check how ARIMA and ETS select components/orders in time series. And I found something interesting&#8230;</p>
<p>One of the important steps in forecasting with statistical models is identifying the existing structure. In the case of ETS, it comes to selecting trend/seasonal components, while for ARIMA, it&#8217;s about order selection. In R, several functions automatically handle this based on information criteria (<a href="https://doi.org/10.18637/jss.v027.i03">Hyndman &#038; Khandakar, 2006</a>; <a href="https://doi.org/10.1080/00207543.2019.1600764">Svetunkov &#038; Boylan (2017)</a>; <a href="https://openforecast.org/adam/ADAMSelection.html">Chapter 15 of ADAM</a>). I decided to investigate how this mechanism works.</p>
<p>I generated data from the Normal distribution with a fixed mean of 5000 and a standard deviation of 50. Then, I asked ETS and ARIMA (from the forecast package in R) to automatically select the appropriate model for each of 1000 time series. Here is the R code for this simple experiment:</p>
<div class="su-accordion su-u-trim"><div class="su-spoiler su-spoiler-style-default su-spoiler-icon-plus su-spoiler-closed" data-scroll-offset="0" data-anchor-in-url="no"><div class="su-spoiler-title" tabindex="0" role="button"><span class="su-spoiler-icon"></span>Some R code</div><div class="su-spoiler-content su-u-clearfix su-u-trim">
<pre class="decode"># Set random seed for reproducibility
set.seed(41, kind="L'Ecuyer-CMRG")
# Number of iterations
nsim <- 1000
# Number of observations
obsAll <- 120
# Generate data from N(5000, 50)
rnorm(nsim*obsAll, 5000, 50) |>
  matrix(obsAll, nsim) |>
  ts(frequency=12) -> x

# Load forecast package
library(forecast)
# Load doMC for parallel calculations
# doMC is only available on Linux and Max
# Use library(doParallel) on Windows
library(doMC)
registerDoMC(detectCores())

# A loop for ARIMA, recording the orders
matArima <- foreach(i=1:nsim, .combine=cbind, .packages=c("forecast")) %dopar% {
    testModel <- auto.arima(x&#091;,i&#093;)
    # The element number 5 is just m, period of seasonality
    return(c(testModel$arma&#091;-5&#093;,(!is.na(testModel$coef&#091;"drift"&#093;))*1))
}
rownames(matArima) <- c("AR","MA","SAR","SMA","I","SI","Drift")

# A loop for ETS, recording the model types
matEts <- foreach(i=1:nsim, .combine=cbind, .packages=c("forecast")) %dopar% {
    testModel <- ets(x&#091;,i&#093;, allow.multiplicative.trend=TRUE)
    return(testModel&#091;13&#093;$method)
}
</pre>
</div></div></div>
<p>The findings of this experiment are summarised using the following chunk of the R code:</p>
<div class="su-accordion su-u-trim"><div class="su-spoiler su-spoiler-style-default su-spoiler-icon-plus su-spoiler-closed" data-scroll-offset="0" data-anchor-in-url="no"><div class="su-spoiler-title" tabindex="0" role="button"><span class="su-spoiler-icon"></span>R code for the analysis of the results</div><div class="su-spoiler-content su-u-clearfix su-u-trim">
<pre class="decode">
#### Auto ARIMA ####
# Non-seasonal ARIMA elements
mean(apply(matArima[c("AR","MA","I","Drift"),]!=0, 2, any))
# Seasonal ARIMA elements
mean(apply(matArima[c("SAR","SMA","SI"),]!=0, 2, any))

#### ETS ####
# Trend in ETS
mean(substr(matEts,7,7)!="N")
# Seasonality in ETS
mean(substr(matEts,nchar(matEts)-1,nchar(matEts)-1)!="N")</pre>
</div></div></div>
<p>I summarised them in the following table:</p>
<table>
<thead>
<tr>
<td></td>
<td><strong>ARIMA</strong></td>
<td><strong>ETS</strong></td>
</tr>
</thead>
<tr>
<td>Non-seasonal elements</td>
<td>24.8%</td>
<td>2.3%</td>
</tr>
<tr>
<td>Seasonal elements</td>
<td>18.0%</td>
<td>0.2%</td>
</tr>
<tr>
<td>Any type of structure</td>
<td>37.9%</td>
<td>2.4%</td>
</tr>
</table>
<p>So, ARIMA detected some structure (had non-zero orders) in almost 40% of all time series, even though the data was designed to have no structure (just white noise). It also captured non-seasonal orders in a quarter of the series and identified seasonality in 18% of them. ETS performed better (only 0.2% of seasonal models identified on the white noise), but still captured trends in 2.3% of cases.</p>
<p>Does this simple experiment suggest that ARIMA is a bad model and ETS is a good one? No, it does not. It simply demonstrates that ARIMA tends to overfit the data if allowed to select whatever it wants. How can we fix that?</p>
<p>My solution: restrict the pool of ARIMA models to check, preventing it from going crazy. My personal pool includes ARIMA(0,1,1), (1,1,2), (0,2,2), along with the seasonal orders of (0,1,1), (1,1,2), and (0,2,2), and combinations between them. This approach is motivated by the connection between <a href="https://openforecast.org/adam/ARIMAandETS.html">ARIMA and ETS</a>. Additionally, we can check whether the addition of AR/MA orders detected by ACF/PACF analysis of the best model reduces the AICc. If not, they shouldn't be included.</p>
<p>This algorithm can be written in the following simple function that uses <code>msarima()</code> function from the smooth package in R (note that the reason why this function is used is because all ARIMA models implemented in the function are directly comparable via information criteria):</p>
<div class="su-accordion su-u-trim"><div class="su-spoiler su-spoiler-style-default su-spoiler-icon-plus su-spoiler-closed" data-scroll-offset="0" data-anchor-in-url="no"><div class="su-spoiler-title" tabindex="0" role="button"><span class="su-spoiler-icon"></span>R code for the compact ARIMA function</div><div class="su-spoiler-content su-u-clearfix su-u-trim">
<pre class="decode">arimaCompact <- function(y, lags=c(1,frequency(y)), ic=c("AICc","AIC","BIC","BICc"), ...){

    # Start measuring the time of calculations
    startTime <- Sys.time();

    # If there are no lags for the basic components, correct this.
    if(sum(lags==1)==0){
        lags <- c(1,lags);
    }

    orderLength <- length(lags);
    ic <- match.arg(ic);
    IC <- switch(ic,
                 "AIC"=AIC,
                 "AICc"=AICc,
                 "BIC"=BIC,
                 "BICc"=BICc);

    # We consider the following list of models:
    # ARIMA(0,1,1), (1,1,2), (0,2,2),
    # ARIMA(0,0,0)+c, ARIMA(0,1,1)+c,
    # seasonal orders (0,1,1), (1,1,2), (0,2,2)
    # And all combinations between seasonal and non-seasonal parts
    # 
    # Encode all non-seasonal parts
    nNonSeasonal <- 5
    arimaNonSeasonal <- matrix(c(0,1,1,0, 1,1,2,0, 0,2,2,0, 0,0,0,1, 0,1,1,1), nNonSeasonal,4,
                               dimnames=list(NULL, c("ar","i","ma","const")), byrow=TRUE)
    # Encode all seasonal parts ()
    nSeasonal <- 4
    arimaSeasonal <- matrix(c(0,0,0, 0,1,1, 1,1,2, 0,2,2), nSeasonal,3,
                               dimnames=list(NULL, c("sar","si","sma")), byrow=TRUE)

    # Check all the models in the pool
    testModels <- vector("list", nSeasonal*nNonSeasonal);
    m <- 1;
    for(i in 1:nSeasonal){
        for(j in 1:nNonSeasonal){
            testModels&#091;&#091;m&#093;&#093; <- msarima(y, orders=list(ar=c(arimaNonSeasonal&#091;j,1&#093;,arimaSeasonal&#091;i,1&#093;),
                                                      i=c(arimaNonSeasonal&#091;j,2&#093;,arimaSeasonal&#091;i,2&#093;),
                                                      ma=c(arimaNonSeasonal&#091;j,3&#093;,arimaSeasonal&#091;i,3&#093;)),
                                       constant=arimaNonSeasonal&#091;j,4&#093;==1, lags=lags, ...);
            m&#091;&#093; <- m+1;
        }
    }

    # Find the best one
    m <- which.min(sapply(testModels, IC));
    # Amend computational time
    testModels&#091;&#091;m&#093;&#093;$timeElapsed <- Sys.time()-startTime;

    return(testModels&#091;&#091;m&#093;&#093;);
}</pre>
</div></div></div>
<p>Additionally, we can check whether the addition of AR/MA orders detected by ACF/PACF analysis of the best model reduces the AICc. If not, they shouldn't be included. I have not added that part in the code above. Still, this algorithm brings some improvements:</p>
<div class="su-accordion su-u-trim"><div class="su-spoiler su-spoiler-style-default su-spoiler-icon-plus su-spoiler-closed" data-scroll-offset="0" data-anchor-in-url="no"><div class="su-spoiler-title" tabindex="0" role="button"><span class="su-spoiler-icon"></span>R code for the application of compact ARIMA to the data</div><div class="su-spoiler-content su-u-clearfix su-u-trim">
<pre class="decode">#### Load the smooth package
library(smooth)

# A loop for the compact ARIMA, recording the orders
matArimaCompact <- foreach(i=1:nsim, .packages=c("smooth")) %dopar% {
    testModel <- arimaCompact(x&#091;,i&#093;)
    return(orders(testModel))
}

#### Auto MSARIMA from smooth ####
# Non-seasonal ARIMA elements
mean(sapply(sapply(matArimaCompact, "&#091;&#091;", "ar"), function(x){x&#091;1&#093;!=0}) |
  sapply(sapply(matArimaCompact, "&#091;&#091;", "i"), function(x){x&#091;1&#093;!=0}) |
  sapply(sapply(matArimaCompact, "&#091;&#091;", "ma"), function(x){x&#091;1&#093;!=0}))

# Seasonal ARIMA elements
mean(sapply(sapply(matArimaSmooth, "&#091;&#091;", "ar"), function(x){length(x)==2 &#038;&#038; (x&#091;2&#093;!=0)}) |
  sapply(sapply(matArimaSmooth, "&#091;&#091;", "i"), function(x){length(x)==2 &#038;&#038; (x&#091;2&#093;!=0)}) |
  sapply(sapply(matArimaSmooth, "&#091;&#091;", "ma"), function(x){length(x)==2 &#038;&#038; (x&#091;2&#093;!=0)}))
</pre>
</div></div></div>
<p>In my case, it resulted in the following:</p>
<table>
<thead>
<tr>
<td></td>
<td><strong>ARIMA</strong></td>
<td><strong>ETS</strong></td>
<td style="text-align: center"><strong>Compact ARIMA</strong></td>
</tr>
</thead>
<tr>
<td>Non-seasonal elements</td>
<td>24.8%</td>
<td>2.3%</td>
<td style="text-align: center">2.4%</td>
</tr>
<tr>
<td>Seasonal elements</td>
<td>18.0%</td>
<td>0.2%</td>
<td style="text-align: center">0.0%</td>
</tr>
<tr>
<td>Any type of structure</td>
<td>37.9%</td>
<td>2.4%</td>
<td style="text-align: center">2.4%</td>
</tr>
</table>
<p>As we see, when we impose restrictions on order selection in ARIMA, it avoids fitting seasonal models to non-seasonal data. While it still makes minor mistakes in terms of non-seasonal structure, it's nothing compared to the conventional approach. What about accuracy? I don't know. I'll have to write another post on this :).</p>
<p>Note that the models were applied to samples of 120 observations, which is considered "small" in statistics, while in real life is sometimes a luxury to have...</p>
<p>Message <a href="https://openforecast.org/2024/04/10/detecting-patterns-in-white-noise/">Detecting patterns in white noise</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2024/04/10/detecting-patterns-in-white-noise/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What&#8217;s wrong with ARIMA?</title>
		<link>https://openforecast.org/2024/03/21/what-s-wrong-with-arima/</link>
					<comments>https://openforecast.org/2024/03/21/what-s-wrong-with-arima/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Thu, 21 Mar 2024 10:10:52 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[Social media]]></category>
		<category><![CDATA[Univariate models]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3366</guid>

					<description><![CDATA[<p>Have you heard of ARIMA? It is one of the benchmark forecasting models used in different academic experiments, although it is not always popular among practitioners. But why? What&#8217;s wrong with ARIMA? ARIMA has been a standard forecasting model in statistics for ages. It gained popularity with the famous Box &#038; Jenkins (1970) book and ... <a title="What&#8217;s wrong with ARIMA?" class="read-more" href="https://openforecast.org/2024/03/21/what-s-wrong-with-arima/" aria-label="Read more about What&#8217;s wrong with ARIMA?">Read more</a></p>
<p>Message <a href="https://openforecast.org/2024/03/21/what-s-wrong-with-arima/">What&#8217;s wrong with ARIMA?</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Have you heard of ARIMA? It is one of the benchmark forecasting models used in different academic experiments, although it is not always popular among practitioners. But why? What&#8217;s wrong with ARIMA?</p>
<p>ARIMA has been a standard forecasting model in statistics for ages. It gained popularity with the famous <a href="https://archive.org/details/timeseriesanalys0000boxg">Box &#038; Jenkins (1970) book</a> and was considered the best forecasting model by statisticians for a couple of decades without any strong evidence to support this.</p>
<p>It represents one of the two fundamental approaches to time series modeling (the second being the state space approach): <a href="https://openforecast.org/adam/ARIMA.html">it captures the relation between the variable and itself in the past</a>. This has a great rationale in technical areas. For example, the quantity of CO2 in a furnace at this moment in time will depend on the quantity of CO2 five minutes ago. Such processes can be efficiently modeled and then forecasted using ARIMA. In demand forecasting, making sense of ARIMA is more challenging: it is hard to argue that the demand for shoes on Monday can impact the demand on Tuesday. So, when we apply ARIMA to such data, we sort of rely on a spurious relation. Still, demand data often exhibits autocorrelations, and ARIMA has been used efficiently in that context.</p>
<p>Over the years, ARIMA did not perform well in different competitions (see <a href="/2024/03/14/the-role-of-m-competitions-in-forecasting/">my post</a> about that), but this was mainly due to the wrong assumptions in <a href="https://openforecast.org/adam/BJApproach.html#BJApproachSummary">Box-Jenkins methodology</a>, not because the model has been fundamentally bad. After <a href="https://doi.org/10.18637/jss.v027.i03">Hyndman &#038; Khandakar (2006)</a> implemented their version with automatic order selection based on information criteria, ARIMA has started producing much more accurate forecasts.</p>
<p>But if I were to summarize what the problem with the model is, I would outline these points:</p>
<ol>
<li>It is hard to explain ARIMA to people who are not comfortable with statistics. Here is an example of how seasonal ARIMA(1,0,1)(1,0,1)_4 is written mathematically:<br />
\begin{equation*}<br />
  y_t (1 -\phi_{4,1} B^4)(1 -\phi_{1} B) = \epsilon_t (1 + \theta_{4,1} B^4) (1 + \theta_{1} B).<br />
\end{equation*}<br />
Good luck explaining this to a demand planner who does not know mathematics.</li>
<li>It is hard to estimate, especially for models with seasonality. It is typically estimated using some numeric optimisation, and reaching the maximum likelihood (or a global minimum of a loss function) is not guaranteed.</li>
<li>It is hard to select the appropriate order of the model, as there can be thousands of potential models to choose from. Yes, there are heuristic approaches that allow simplifying the problem and selecting a reasonable model (e.g. <a href="https://doi.org/10.18637/jss.v027.i03">Hyndman &#038; Khandakar, 2006</a>; or <a href="https://doi.org/10.1080/00207543.2019.1600764">Svetunkov &#038; Boylan, 2017</a>), but they do not guarantee that you will get the best possible model.</li>
</ol>
<p>Nonetheless, ARIMA is a strong contender that can outperform other models if implemented well. Furthermore, it has become one of the standard forecasting benchmarks in forecasting-related experiments. So, if you are a data scientist comfortable with mathematics and want to see how your machine learning approach performs, you should consider including ARIMA as a benchmark.</p>
<p>P.S. Check out <a href="https://www.linkedin.com/posts/vandeputnicolas_i-am-not-aware-of-any-successful-use-at-activity-7148632910441377793-27s5">a post by Nicolas Vandeput on LinkedIn</a> &#8211; he had a discussion about ARIMA and raised good points as well.</p>
<p>Message <a href="https://openforecast.org/2024/03/21/what-s-wrong-with-arima/">What&#8217;s wrong with ARIMA?</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2024/03/21/what-s-wrong-with-arima/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Multi-step Estimators and Shrinkage Effect in Time Series Models</title>
		<link>https://openforecast.org/2023/08/09/multi-step-estimators-and-shrinkage-effect-in-time-series-models/</link>
					<comments>https://openforecast.org/2023/08/09/multi-step-estimators-and-shrinkage-effect-in-time-series-models/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Wed, 09 Aug 2023 10:14:59 +0000</pubDate>
				<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[Package smooth for R]]></category>
		<category><![CDATA[Papers]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Univariate models]]></category>
		<category><![CDATA[extrapolation methods]]></category>
		<category><![CDATA[Loss functions]]></category>
		<category><![CDATA[papers]]></category>
		<category><![CDATA[theory]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3142</guid>

					<description><![CDATA[<p>Authors: Ivan Svetunkov, Nikos Kourentzes, Rebecca Killick Journal: Computational Statistics Abstract: Many modern statistical models are used for both insight and prediction when applied to data. When models are used for prediction one should optimise parameters through a prediction error loss function. Estimation methods based on multiple steps ahead forecast errors have been shown to ... <a title="Multi-step Estimators and Shrinkage Effect in Time Series Models" class="read-more" href="https://openforecast.org/2023/08/09/multi-step-estimators-and-shrinkage-effect-in-time-series-models/" aria-label="Read more about Multi-step Estimators and Shrinkage Effect in Time Series Models">Read more</a></p>
<p>Message <a href="https://openforecast.org/2023/08/09/multi-step-estimators-and-shrinkage-effect-in-time-series-models/">Multi-step Estimators and Shrinkage Effect in Time Series Models</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Authors</strong>: Ivan Svetunkov, <a href="http://kourentzes.com/forecasting/">Nikos Kourentzes</a>, <a href="https://www.lancaster.ac.uk/maths/people/rebecca-killick">Rebecca Killick</a></p>
<p><strong>Journal</strong>: <a href="https://www.springer.com/journal/180">Computational Statistics</a></p>
<p><strong>Abstract</strong>: Many modern statistical models are used for both insight and prediction when applied to data. When models are used for prediction one should optimise parameters through a prediction error loss function. Estimation methods based on multiple steps ahead forecast errors have been shown to lead to more robust and less biased estimates of parameters. However, a plausible explanation of why this is the case is lacking. In this paper, we provide this explanation, showing that the main benefit of these estimators is in a shrinkage effect, happening in univariate models naturally. However, this can introduce a series of limitations, due to overly aggressive shrinkage. We discuss the predictive likelihoods related to the multistep estimators and demonstrate what their usage implies to time series models. To overcome the limitations of the existing multiple steps estimators, we propose the Geometric Trace Mean Squared Error, demonstrating its advantages. We conduct a simulation experiment showing how the estimators behave with different sample sizes and forecast horizons. Finally, we carry out an empirical evaluation on real data, demonstrating the performance and advantages of the estimators. Given that the underlying process to be modelled is often unknown, we conclude that the shrinkage achieved by the GTMSE is a competitive alternative to conventional ones.</p>
<p><strong>DOI</strong>: <a href="https://doi.org/10.1007/s00180-023-01377-x">10.1007/s00180-023-01377-x</a>.</p>
<p><a href="http://dx.doi.org/10.13140/RG.2.2.17854.31043">Working paper</a>.</p>
<h2>About the paper</h2>
<p><b>DISCLAIMER 1</b>: To better understand what I am talking about in this section, I would recommend you to have a look at the <a href="https://openforecast.org/adam/">ADAM monograph</a>, and specifically at <a href="https://openforecast.org/adam/ADAMETSEstimation.html">the Chapter 11</a>. In fact, <a href="https://openforecast.org/adam/multistepLosses.html">Section 11.3</a> is based on this paper.</p>
<p><b>DISCLAIMER 2</b>: All the discussions in the paper only apply to pure additive models. If you are interested in multiplicative or mixed ETS models, you&#8217;ll have to wait another seven years for another paper on this topic to get written and published.</p>
<h3>Introduction</h3>
<p>There are lots of ways how dynamic models can be estimated. Some analysts prefer likelihood, some would stick with Least Squares (i.e. minimising MSE), while others would use advanced estimators like Huber&#8217;s loss or M-estimators. And sometimes, statisticians or machine learning experts would use multiple steps ahead estimators. For example, they would use a so-called &#8220;direct forecast&#8221; by fitting a model to the data, producing h-steps ahead in-sample point forecasts from the very first to the very last observation, then calculating the respective h-steps ahead forecast errors and (based on them) Mean Squared Error. Mathematically, this can be written as:</p>
<p>\begin{equation} \label{eq:hstepsMSE}<br />
	\mathrm{MSE}_h = \frac{1}{T-h} \sum_{t=1}^{T-h} e_{t+h|t}^2 ,<br />
\end{equation}<br />
where \(e_{t+h|t}\) is the h-steps ahead error for the point forecast produced from the observation \(t\), and \(T\) is the sample size.</p>
<p>In my final year of PhD, I have decided to analyse how different multistep loss functions work, to understand what happens with dynamic models, when these losses are minimised, and how this can help in efficient model estimation. Doing the literature review, I noticed that the claims about the multistep estimators are sometimes contradictory: some authors say that they are more efficient (i.e. estimates of parameters have lower variances) than the conventional estimators, some say that they are less efficient; some claim that they improve accuracy, while the others do not find any substantial improvements. Finally, I could not find a proper explanation of what happens with the dynamic models when the estimators are used. So, I&#8217;ve started my own investigation, together with Nikos Kourentzes and Rebecca Killick (who was my internal examiner and joined our team after my graduation).</p>
<p>Our investigation started with the single source of error model, then led us to predictive likelihoods and, after that &#8211; to the development of a couple of non-conventional estimators. As a result, the paper grew and became less focused than initially intended. In the end, it became 42 pages long and discussed several aspects of models estimation (making it a bit of a hodgepodge):</p>
<ol>
<li>How multistep estimators regularise parameters of dynamic models;</li>
<li>That multistep forecast errors are always correlated when the models&#8217; parameters are not zero;</li>
<li>What predictive likelihoods align with the multistep estimators (this is useful for a discussion of their statistical properties);</li>
<li>How General Predictive Likelihood encompasses all popular multistep estimators;</li>
<li>And that there is another estimator (namely GTMSE &#8211; Geometric Trace Mean Squared Error), which has good properties and has not been discussed in the literature before.</li>
</ol>
<p>Because of the size of the paper and the spread of the topics throughout it, many reviewers ignored (1) &#8211; (4), focusing on (5) and thus rejecting the paper on the grounds that we propose a new estimator, but instead spend too much time discussing irrelevant topics. These types of comments were given to us by the editor of the Journal of the Royal Statistical Society: B and reviewers of Computational Statistics and Data Analysis. While we tried addressing this issue several times, given the size of the paper, we failed to fix it fully. The paper was rejected from both of these journals and ended up in Computational Statistics, where the editor gave us a chance to respond to the comments. We explained what the paper was really about and changed its focus to satisfy the reviewers, after which the paper was accepted.</p>
<p>So, what are the main findings of this paper?</p>
<h3>How multistep estimators regularise parameters of dynamic models</h3>
<p>Given that any dynamic model (such as ETS or ARIMA) can be represented in the Single Source of Error state space form, we showed that the application of multistep estimators leads to the inclusion of parameters of models in the loss function, leading to the regularisation. In ETS, this means that the smoothing parameters are shrunk to zero, with the shrinkage becoming stronger with the increase of the forecasting horizon relative to the sample size. This makes the models less stochastic and more conservative. Mathematically this becomes apparent if we express the conditional multistep variance in terms of smoothing parameters and one-step-ahead error variance. For example, for ETS(A,N,N) we have:</p>
<p>\begin{equation} \label{eq:hstepsMSEVariance}<br />
	\mathrm{MSE}_h \propto \hat{\sigma}_1^2 \left(1 +(h-1) \hat{\alpha} \right),<br />
\end{equation}<br />
where \( \hat{\alpha} \) is the smoothing parameter and \(\hat{\sigma}_1^2 \) is the one-step-ahead error variance. From the formula \eqref{eq:hstepsMSEVariance}, it becomes apparent that when we minimise MSE\(_h\), the estimated variance and the smoothing parameters will be minimised as well. This is how the shrinkage effect appears: we force \( \hat{\alpha} \) to become as close to zero as possible, and the strength of shrinkage is regulated by the forecasting horizon \( h \).</p>
<p>In the paper itself, we discuss this effect for several multistep estimators (the specific effect would be different between them) and several ETS and ARIMA models. While for ETS, it is easy to show how shrinkage works, for ARIMA, the situation is more complicated because the direction of shrinkage would change with the ARIMA orders. Still, what can be said clearly for any dynamic model is that the multistep estimators make them less stochastic and more conservative.</p>
<h3>Multistep forecast errors are always correlated</h3>
<p>This is a small finding, done in bypassing. It means that, for example, the forecast error two steps ahead is always correlated with the three steps ahead one. This does not depend on the autocorrelation of residuals or any violation of assumptions of the model but rather only on whether the parameters of the model are zero or not. This effect arises from the model rather than from the data. The only situation when the forecast errors will not be correlated is when the model is deterministic (e.g. linear trend). This has important practical implications because some forecasting techniques make explicit and unrealistic assumptions that these correlations are zero, which would impact the final forecasts.</p>
<h3>Predictive likelihoods aligning with the multistep estimators</h3>
<p>We showed that if a model assumes the Normal distribution, in the case of MSEh and MSCE (Mean Squared Cumulative Error), the distribution of the future values follows Normal as well. This means that there are predictive likelihood functions for these models, the maximum of which is achieved with the same set of parameters as the minimum of the multistep estimators. This has two implications:</p>
<ol>
<li>These multistep estimators should be consistent and efficient, especially when the smoothing parameters are close to zero;</li>
<li>The predictive likelihoods can be used in the model selection via information criteria.</li>
</ol>
<p>The first point also explains the contradiction in the literature: if the smoothing parameter in the population is close to zero, then the multistep estimators will give more efficient estimates than the conventional estimators; in the other case, it might be less efficient. We have not used the second point above, but it would be useful when the best model needs to be selected for the data, and an analyst wants to use information criteria. This is one of the potential ways for future research.</p>
<h3>How General Predictive Likelihood (GPL) encompasses all popular multistep estimators</h3>
<p>GPL arises when the joint distribution of 1 to h steps ahead forecast errors is considered. It will be Multivariate Normal if the model assumes normality. In the paper, we showed that the maximum of GPL coincides with the minimum of the so-called &#8220;Generalised Variance&#8221; &#8211; the determinant of the covariance matrix of forecast errors. This minimisation reduces variances for all the forecast errors (from 1 to h) and increases the covariances between them, making the multistep forecast errors look more similar. In the perfect case, when the model is correctly specified (no omitted or redundant variables, homoscedastic residuals etc), the maximum of GPL will coincide with the maximum of the conventional likelihood of the Normal distribution (see <a href="https://openforecast.org/adam/ADAMETSEstimationLikelihood.html">Section 11.1 of the ADAM monograph</a>).</p>
<p>Accidentally, it can be shown that the existing estimators are just special cases of the GPL, but with some restrictions on the covariance matrix. I do not intend to show it here, the reader is encouraged to either read the paper or see the brief discussion <a href="https://openforecast.org/adam/multistepLosses.html#multistepLossesGPL">in Subsection 11.3.5</a> of the ADAM monograph.</p>
<h3>GTMSE &#8211; Geometric Trace Mean Squared Error</h3>
<p>Finally, looking at the special cases of GPL, we have noticed that there is one which has not been discussed in the literature. We called it Geometric Trace Mean Squared Error (GTMSE) because of the logarithms in the formula:<br />
\begin{equation} \label{eq:GTMSE}<br />
	\mathrm{GTMSE} = \sum_{j=1}^h \log \frac{1}{T-j} \sum_{t=1}^{T-j} e_{t+j|t}^2 .<br />
\end{equation}<br />
GTMSE imposes shrinkage on parameters similar to other estimators but does it more mildly because of the logarithms in the formula. In fact, what the logarithms do is make variances of all forecast errors similar to each other. As a result, when used, GTMSE does not focus on the larger variances as other methods do but minimises all of them simultaneously similarly.</p>
<h2>Examples in R</h2>
<p>The estimators discussed in the paper are all implemented in the functions of the smooth package in R, including <code>adam()</code>, <code>es()</code>, <code>ssarima()</code>, <code>msarima()</code> and <code>ces()</code>. In the example below, we will see how the shrinkage works for the ETS on the example of Box-Jenkins sales data (this is the example taken from ADAM, <a href="https://openforecast.org/adam/multistepLosses.html#an-example-in-r-2">Subsection 11.3.7</a>):</p>
<pre class="decode">library(smooth)

adamETSAANBJ <- vector("list",6)
names(adamETSAANBJ) <- c("MSE","MSEh","TMSE","GTMSE","MSCE","GPL")
for(i in 1:length(adamETSAANBJ)){
    adamETSAANBJ[[i]] <- adam(BJsales, "AAN", h=10, holdout=TRUE,
                              loss=names(adamETSAANBJ)[i])
}</pre>
<p>The ETS(A,A,N) model, applied to this data, has different estimates of smoothing parameters:</p>
<pre class="decode">sapply(adamETSAANBJ,"[[","persistence") |>
	round(5)</pre>
<pre>          MSE MSEh TMSE   GTMSE MSCE GPL
alpha 1.00000    1    1 1.00000    1   1
beta  0.23915    0    0 0.14617    0   0</pre>
<p>We can see how shrinkage shows itself in the case of the smoothing parameter \(\beta\), which is shrunk to zero by MSEh, TMSE, MSCE and GPL but left intact by MSE and shrunk a little bit in the case of GTMSE. These different estimates of parameters lead to different forecasting trajectories and prediction intervals, as can be shown visually:</p>
<pre class="decode">par(mfcol=c(3,2), mar=c(2,2,4,1))
# Produce forecasts
lapply(adamETSAANBJ, forecast, h=10, interval="prediction") |>
# Plot forecasts
    lapply(function(x, ...) plot(x, ylim=c(200,280), main=x$model$loss))</pre>
<p>This should result in the following plots:</p>
<figure id="attachment_3162" aria-describedby="caption-attachment-3162" style="width: 1190px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/07/ADAMBJSalesLosses.png&amp;nocache=1"><img decoding="async" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/07/ADAMBJSalesLosses.png&amp;nocache=1" alt="ADAM ETS on Box-Jenkins data with several estimators" width="1200" height="700" class="size-full wp-image-3162" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/07/ADAMBJSalesLosses.png&amp;nocache=1 1200w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/07/ADAMBJSalesLosses-300x175.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/07/ADAMBJSalesLosses-1024x597.png&amp;nocache=1 1024w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/07/ADAMBJSalesLosses-768x448.png&amp;nocache=1 768w" sizes="(max-width: 1200px) 100vw, 1200px" /></a><figcaption id="caption-attachment-3162" class="wp-caption-text">ADAM ETS on Box-Jenkins data with several estimators</figcaption></figure>
<p>Analysing the figure, it looks like the shrinkage of the smoothing parameter \(\beta\) is useful for this time series: the forecasts from ETS(A,A,N) estimated using MSEh, TMSE, MSCE and GPL look closer to the actual values than the ones from MSE and GTMSE. To assess their performance more precisely, we can extract error measures from the models:</p>
<pre class="decode">sapply(adamETSAANBJ,"[[","accuracy") |>
	round(5)[c("ME","MSE"),]</pre>
<pre>         MSE    MSEh    TMSE    GTMSE    MSCE     GPL
ME   3.22900 1.06479 1.05233  3.44962 1.04604 0.95515
MSE 14.41862 2.89067 2.85880 16.26344 2.84288 2.62394</pre>
<p>Alternatively, we can calculate error measures based on the produced forecasts and the <code>measures()</code> function from the <code>greybox</code> package:</p>
<pre class="decode">lapply(adamETSAANBJ, forecast, h=10) |>
    sapply(function(x, ...) measures(holdout=x$model$holdout,
                                     forecast=x$mean,
                                     actual=actuals(x$model)))</pre>
<p>A thing to note about the multistep estimators is that they are slower than the conventional ones because they require producing 1 to \( h \) steps ahead forecasts from every observation in-sample. In the case of the <code>smooth</code> functions, the time elapsed can be extracted from the models in the following way:</p>
<pre class="decode">sapply(adamETSAANBJ, "[[", "timeElapsed")</pre>
<p>In summary, the multistep estimators are potentially useful in forecasting and can produce models with more accurate forecasts. This happens because they impose shrinkage on the estimates of parameters, making models less stochastic and more inert. But their performance depends on each specific situation and the available data, so I would not recommend using them universally.</p>
<p>Message <a href="https://openforecast.org/2023/08/09/multi-step-estimators-and-shrinkage-effect-in-time-series-models/">Multi-step Estimators and Shrinkage Effect in Time Series Models</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2023/08/09/multi-step-estimators-and-shrinkage-effect-in-time-series-models/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>smooth v3.2.0: what&#8217;s new?</title>
		<link>https://openforecast.org/2023/01/30/smooth-v3-2-0-what-s-new/</link>
					<comments>https://openforecast.org/2023/01/30/smooth-v3-2-0-what-s-new/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Mon, 30 Jan 2023 13:06:47 +0000</pubDate>
				<category><![CDATA[About es() function]]></category>
		<category><![CDATA[adam()]]></category>
		<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[Package smooth for R]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Univariate models]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[smooth]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=3063</guid>

					<description><![CDATA[<p>smooth package has reached version 3.2.0 and is now on CRAN. While the version change from 3.1.7 to 3.2.0 looks small, this has introduced several substantial changes and represents a first step in moving to the new C++ code in the core of the functions. In this short post, I will outline the main new ... <a title="smooth v3.2.0: what&#8217;s new?" class="read-more" href="https://openforecast.org/2023/01/30/smooth-v3-2-0-what-s-new/" aria-label="Read more about smooth v3.2.0: what&#8217;s new?">Read more</a></p>
<p>Message <a href="https://openforecast.org/2023/01/30/smooth-v3-2-0-what-s-new/">smooth v3.2.0: what&#8217;s new?</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>smooth package has reached version 3.2.0 and is now <a href="https://cran.r-project.org/package=smooth">on CRAN</a>. While the version change from 3.1.7 to 3.2.0 looks small, this has introduced several substantial changes and represents a first step in moving to the new C++ code in the core of the functions. In this short post, I will outline the main new features of smooth 3.2.0.</p>
<p><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2.png&amp;nocache=1"><img decoding="async" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2-300x218.png&amp;nocache=1" alt="" width="300" height="218" class="aligncenter size-medium wp-image-3065" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2-300x218.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2-1024x745.png&amp;nocache=1 1024w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2-768x559.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2-1536x1117.png&amp;nocache=1 1536w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/smooth2.png&amp;nocache=1 1650w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<h3>New engines for ETS, MSARIMA and SMA</h3>
<p>The first and one of the most important changes is the new engine for the ETS (Error-Trend-Seasonal exponential smoothing model), MSARIMA (Multiple Seasonal ARIMA) and SMA (Simple Moving Average), implemented respectively in <code>es()</code>, <code>msarima()</code> and <code>sma()</code> functions. The new engine was developed for <code>adam()</code> and the three models above can be considered as special cases of it. You can read more about ETS in ADAM monograph, starting from<a href="https://openforecast.org/adam/ETSConventional.html"> Chapter 4</a>; MSARIMA is discussed in <a href="https://openforecast.org/adam/ADAMARIMA.html">Chapter 9</a>, while SMA is briefly discussed in <a href="https://openforecast.org/adam/simpleForecastingMethods.html#SMA">Subsection 3.3.3</a>.</p>
<p>The <code>es()</code> function now implements the ETS close to the conventional one, assuming that the error term follows normal distribution. It still supports explanatory variables (discussed in <a href="https://openforecast.org/adam/ADAMX.html">Chapter 10 of ADAM monograph</a>) and advanced estimators (<a href="https://openforecast.org/adam/ADAMETSEstimation.html">Chapter 11</a>), and it has the same syntax as the previous version of the function had, but now acts as a wrapper for <code>adam()</code>. This means that it is now faster, more accurate and requires less memory than it used to. <code>msarima()</code> being a wrapper of <code>adam()</code> as well, is now also faster and more accurate than it used to be. But in addition to that both functions now support the methods that were developed for <code>adam()</code>, including <code>vcov()</code>, <code>confint()</code>, <code>summary()</code>, <code>rmultistep()</code>, <code>reapply()</code>, <code>plot()</code> and others. So, now you can do more thorough analysis and improve the models using all these advanced instruments (see, for example, <a href="https://openforecast.org/adam/diagnostics.html">Chapter 14 of ADAM</a>).</p>
<p>The main reason why I moved the functions to the new engine was to clean up the code and remove the old chunks that were developed when I only started learning C++. A side effect, as you see, is that the functions have now been improved in a variety of ways.</p>
<p>And to be on the safe side, the old versions of the functions are still available in <code>smooth</code> under the names <code>es_old()</code>, <code>msarima_old()</code> and <code>sma_old()</code>. They will be removed from the package if it ever reaches the v.4.0.0.</p>
<h3>New methods for ADAM</h3>
<p>There are two new methods for <code>adam()</code> that can be used in a variety of cases. The first one is <code>simulate()</code>, which will generate data based on the estimated ADAM, whatever the original model is (e.g. mixture of ETS, ARIMA and regression on the data with multiple frequencies). Here is how it can be used:</p>
<pre class="decode">adam(BJsales, "AAdN") |>
     simulate() |>
     plot()</pre>
<p>which will produce a plot similar to the following:</p>
<figure id="attachment_3077" aria-describedby="caption-attachment-3077" style="width: 630px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamSimulate.png&amp;nocache=1"><img loading="lazy" decoding="async" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamSimulate-1024x597.png&amp;nocache=1" alt="Simulated data based on adam() applied to Box-Jenkins sales data" width="640" height="373" class="size-large wp-image-3077" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamSimulate-1024x597.png&amp;nocache=1 1024w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamSimulate-300x175.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamSimulate-768x448.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamSimulate.png&amp;nocache=1 1200w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><figcaption id="caption-attachment-3077" class="wp-caption-text">Simulated data based on adam() applied to Box-Jenkins sales data</figcaption></figure>
<p>This can be used for research, when a more controlled environment is needed. If you want to fine tune the parameters of ADAM before simulating the data, you can save the output in an object and amend its parameters. For example:</p>
<pre class="decode">testModel <- adam(BJsales, "AAdN")
testModel$persistence <- c(0.5, 0.2)
simulate(testModel)</pre>
<p>The second new method is the <code>xtable()</code> from the respective <code>xtable</code> package. It produces LaTeX version of the table from the summary of ADAM. Here is an example of a summary from ADAM ETS:</p>
<pre class="decode">adam(BJsales, "AAdN") |>
     summary()</pre>
<pre>Model estimated using adam() function: ETS(AAdN)
Response variable: BJsales
Distribution used in the estimation: Normal
Loss function type: likelihood; Loss function value: 256.1516
Coefficients:
      Estimate Std. Error Lower 2.5% Upper 97.5%  
alpha   0.9514     0.1292     0.6960      1.0000 *
beta    0.3328     0.2040     0.0000      0.7358  
phi     0.8560     0.1671     0.5258      1.0000 *
level 203.2835     5.9968   191.4304    215.1289 *
trend  -2.6793     4.7705   -12.1084      6.7437  

Error standard deviation: 1.3623
Sample size: 150
Number of estimated parameters: 6
Number of degrees of freedom: 144
Information criteria:
     AIC     AICc      BIC     BICc 
524.3032 524.8907 542.3670 543.8387</pre>
<p>As you can see in the output above, the function generates the confidence intervals for the parameters of the model, including the smoothing parameters, dampening parameter and the initial states. This summary can then be used to generate the LaTeX code for the main part of the table:</p>
<pre class="decode">adam(BJsales, "AAdN") |>
     xtable()</pre>
<p>which will looks something like this:</p>
<figure id="attachment_3073" aria-describedby="caption-attachment-3073" style="width: 630px" class="wp-caption aligncenter"><a href="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamXtable.png&amp;nocache=1"><img loading="lazy" decoding="async" src="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamXtable-1024x303.png&amp;nocache=1" alt="Summary of adam()" width="512" height="152" class="size-large wp-image-3073" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamXtable-1024x303.png&amp;nocache=1 1024w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamXtable-300x89.png&amp;nocache=1 300w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamXtable-768x227.png&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2023/01/adamXtable.png&amp;nocache=1 1207w" sizes="auto, (max-width: 512px) 100vw, 512px" /></a><figcaption id="caption-attachment-3073" class="wp-caption-text">Summary of adam()</figcaption></figure>
<h3>Other improvements</h3>
<p>First, one of the major changes in <code>smooth</code> functions is the new backcasting mechanism for <code>adam()</code>, <code>es()</code> and <code>msarima()</code> (this is discussed in <a href="https://openforecast.org/adam/ADAMInitialisation.html">Section 11.4 of ADAM monograph</a>). The main difference with the old one is that now it does not backcast the parameters for the explanatory variables and estimates them separately via optimisation. This feature appeared to be important for some of users who wanted to try MSARIMAX/ETSX (a model with explanatory variables) but wanted to use backcasting as the initialisation. These users then wanted to get a summary, analysing the uncertainty around the estimates of parameters for exogenous variables, but could not because the previous implementation would not estimate them explicitly. This is now available. Here is an example:</p>
<pre class="decode">cbind(BJsales, BJsales.lead) |>
    adam(model="AAdN", initial="backcasting") |>
    summary()</pre>
<pre>Model estimated using adam() function: ETSX(AAdN)
Response variable: BJsales
Distribution used in the estimation: Normal
Loss function type: likelihood; Loss function value: 255.1935
Coefficients:
             Estimate Std. Error Lower 2.5% Upper 97.5%  
alpha          0.9724     0.1108     0.7534      1.0000 *
beta           0.2904     0.1368     0.0199      0.5607 *
phi            0.8798     0.0925     0.6970      1.0000 *
BJsales.lead   0.1662     0.2336    -0.2955      0.6276  

Error standard deviation: 1.3489
Sample size: 150
Number of estimated parameters: 5
Number of degrees of freedom: 145
Information criteria:
     AIC     AICc      BIC     BICc 
520.3870 520.8037 535.4402 536.4841</pre>
<p>As you can see in the output above, the initial level and trend of the model are not reported, because they were estimated via backcasting. However, we get the value of the parameter <code>BJsales.lead</code> and the uncertainty around it. The old backcasting approach is now called "complete", implying that all values of the state vector are produce via backcasting.</p>
<p>Second, <code>forecast.adam()</code> now has a parameter <code>scenarios</code>, which when TRUE will return the simulated paths from the model. This only works when <code>interval="simulated"</code> and can be used for the analysis of possible forecast trajectories.</p>
<p>Third, the <code>plot()</code> method now can also produce ACF/PACF for the squared residuals for all <code>smooth</code> functions. This becomes useful if you suspect that your data has ARCH elements and want to see if they need to be modelled separately. This can also be done using <code>adam()</code> and <code>sm()</code> and is discussed in <a href="https://openforecast.org/adam/ADAMscaleModel.html">Chapter 17 of the monograph</a>.</p>
<p>Finally, the <code>sma()</code> function now has the <code>fast</code> parameter, which when true will use a modified Ternary search for the best order based on information criteria. It might not give the global minimum, but it works much faster than the exhaustive search.</p>
<h3>Conclusions</h3>
<p>These are the main new features in the package. I feel that the main job in <code>smooth</code> is already done, and all I can do now is just tune the functions and improve the existing code. I want to move all the functions to the new engine and ditch the old one, but this requires much more time than I have. So, I don't expect to finish this any time soon, but I hope I'll get there someday. On the other hand, I'm not sure that spending much time on developing an R package is a wise idea, given that nowadays people tend to use Python. I would develop Python analogue of the <code>smooth</code> package, but currently I don't have the necessary expertise and time to do that. Besides, there already exist great libraries, such as <a href="https://github.com/Nixtla/nixtla/tree/main/tsforecast">tsforecast</a> from <a href="https://github.com/Nixtla/nixtla">nixtla</a> and <a href="https://www.sktime.org/">sktime</a>. I am not sure that another library, implementing ETS and ARIMA is needed in Python. What do you think?</p>
<p>Message <a href="https://openforecast.org/2023/01/30/smooth-v3-2-0-what-s-new/">smooth v3.2.0: what&#8217;s new?</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2023/01/30/smooth-v3-2-0-what-s-new/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>ISF2022: How to make ETS work with ARIMA</title>
		<link>https://openforecast.org/2022/07/20/isf2022-how-to-make-ets-work-with-arima/</link>
					<comments>https://openforecast.org/2022/07/20/isf2022-how-to-make-ets-work-with-arima/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Svetunkov]]></dc:creator>
		<pubDate>Wed, 20 Jul 2022 12:06:48 +0000</pubDate>
				<category><![CDATA[adam()]]></category>
		<category><![CDATA[ARIMA]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[ETS]]></category>
		<category><![CDATA[ADAM]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[ISF]]></category>
		<category><![CDATA[presentations]]></category>
		<guid isPermaLink="false">https://openforecast.org/?p=2984</guid>

					<description><![CDATA[<p>This time ISF took place in Oxford. I acted as a programme chair of the event and was quite busy with schedule and some other minor organisational things, but I still found time to present something new. Specifically, I talked about one specific part of ADAM, the part implementing ETS+ARIMA. The idea is that the ... <a title="ISF2022: How to make ETS work with ARIMA" class="read-more" href="https://openforecast.org/2022/07/20/isf2022-how-to-make-ets-work-with-arima/" aria-label="Read more about ISF2022: How to make ETS work with ARIMA">Read more</a></p>
<p>Message <a href="https://openforecast.org/2022/07/20/isf2022-how-to-make-ets-work-with-arima/">ISF2022: How to make ETS work with ARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This time ISF took place in Oxford. I acted as a programme chair of the event and was quite busy with schedule and some other minor organisational things, but I still found time to present something new. Specifically, I talked about one specific part of ADAM, the part implementing ETS+ARIMA. The idea is that the two models are considered as competing, belonging to different families. But we have known how to unite them at least since 1985. So, it is about time to make this brave step and implement ETS with ARIMA elements.</p>
<figure id="attachment_2987" aria-describedby="caption-attachment-2987" style="width: 215px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2022/07/7971a13b-ad97-4473-8a8f-4c88ad2d7145.jpeg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2022/07/7971a13b-ad97-4473-8a8f-4c88ad2d7145-225x300.jpeg" alt="" width="225" height="300" class="size-medium wp-image-2987" srcset="https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2022/07/7971a13b-ad97-4473-8a8f-4c88ad2d7145-225x300.jpeg&amp;nocache=1 225w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2022/07/7971a13b-ad97-4473-8a8f-4c88ad2d7145-768x1024.jpeg&amp;nocache=1 768w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2022/07/7971a13b-ad97-4473-8a8f-4c88ad2d7145-1152x1536.jpeg&amp;nocache=1 1152w, https://openforecast.org/wp-content/webpc-passthru.php?src=https://openforecast.org/wp-content/uploads/2022/07/7971a13b-ad97-4473-8a8f-4c88ad2d7145.jpeg&amp;nocache=1 1536w" sizes="auto, (max-width: 225px) 100vw, 225px" /></a><figcaption id="caption-attachment-2987" class="wp-caption-text">ETS+ARIMA love story with happy ending&#8230;</figcaption></figure>
<p>This talk was based on <a href="https://openforecast.org/adam/ADAMARIMA.html">Chapter 9</a> of <a href="https://openforecast.org/adam/">ADAM monograph</a>, and more specifically on <a href="https://openforecast.org/adam/ETSAndARIMA.html">Section 9.4</a>.</p>
<p>The slides of the presentation are available <a href="/wp-content/uploads/2022/07/2022-ISF2022-ADAM-ETSARIMA.pdf">here</a>.</p>
<p>Message <a href="https://openforecast.org/2022/07/20/isf2022-how-to-make-ets-work-with-arima/">ISF2022: How to make ETS work with ARIMA</a> first appeared on <a href="https://openforecast.org">OpenForecast</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://openforecast.org/2022/07/20/isf2022-how-to-make-ets-work-with-arima/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
