Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOTE not shown #200

Closed
waynefoltaERI opened this issue Mar 14, 2017 · 6 comments
Closed

NOTE not shown #200

waynefoltaERI opened this issue Mar 14, 2017 · 6 comments
Labels

Comments

@waynefoltaERI
Copy link

waynefoltaERI commented Mar 14, 2017

GREAT package! One seeming bug I've encountered: the default mode is to use SEATS seasonal adjustment. When I added a single xreg variable:

sm2 <- seas (x1, x2, forecast.maxlead="4", series.span=",2016.6")

I immediately get an error:


Errors:
- forecasts end date, 2019.Jun, must end on or before user-defined regression variables end date, 2016.Oct.

As it says, my data ends 2016.Oct, but I am asking it to stop at 2016.June and to only predict 4 months. If I do:

sm2 <- seas (x1, x2, forecast.maxlead="4", series.span=",2016.6", x11="")

it works as expected, no error. It also seems to work as expected if I use SEATS but eliminate the xreg:

sm2 <- seas (x1, forecast.maxlead="4", series.span=",2016.6")

@christophsax
Copy link
Owner

christophsax commented Mar 21, 2017

This is probably in the 'feature-not-bug' section: It seems SEATS just requires a minimal forecast period of 3 years, no matter if external regressors are used or not. I couldn't find anything on this in the manual, but seasonal is not manipulating anyting on this arguments.

Here's a reproducible example:

library(seasonal) 

# external regressor
cny.ts <- genhol(cny, start = 0, end = 6, center = "calendar")

# This works
m1 <- seas(x = imp, xreg = window(cny.ts, end = c(2012, 12)), 
           forecast.maxlead = "3", series.span=", 2012.9", x11 = "")

# This does not work, because SEATS insists on a 3 year forcast:
m2 <- seas(x = imp, xreg = window(cny.ts, end = c(2012, 12)), 
           forecast.maxlead = 3, series.span=", 2012.9")

# Which has nothing to do with xreg, SEATS just wants to produce a 3 year forecast 
m3 <- seas(x = imp, forecast.maxlead = 3, series.span=", 2012.9")
series(m3, "forecast.forecasts")

# Longer forecast periods are accepted:
m4 <- seas(x = imp, forecast.maxlead = 48, series.span=", 2012.9")
series(m4, "forecast.forecasts")

The manual says about maxlead:

Number of forecasts produced. The default is one year of forecasts (unless a SEATS seasonal adjustment is requested - then the default is three years of forecasts) and 120 is the maximum.

So nothing on a minimal forecast period, but the 3 three years forecast seem to be crucial for SEATS.

@waynefoltaERI
Copy link
Author

I was hoping that the " -- then the default is three years" part meant what is said default and that SEATS might just have a different name for maxlead that I hadn't yet found. Is this literally a possible bug in X13-ARIMA-SEATS?

@christophsax
Copy link
Owner

I don't think it's a bug, it is just that SEATS requires at least that much of a forecast, something that is not properly documented. But this just my guess.

Anyway, this is a behavior you see with X-13 and not particularly with seasonal.

@waynefoltaERI
Copy link
Author

Sounds reasonable. I wouldn't want to dirty-up the code base, but it might worth looking into printing a warning message when a seasonal user specifies maxlead in a situation where SEATS will be used. A little value-added on top of X13, since seasonal is making X13 accessible to more users who may not be as comfortable poking into X13 itself. I'll go ahead and close this.

@christophsax
Copy link
Owner

In fact, X-13 does produce a note, and we can see it by typing:

out(m3)

Which answers the question:

NOTE: A longer forecast horizon is required by the SEATS signal extraction procedure, so the number of forecasts generated by this run has been changed to 36.

Now, generally, notes, messages and errors are shown in seasonal. Why it is not shown here is something I have to look at.

@christophsax christophsax added bug and removed wontfix labels Mar 21, 2017
@christophsax christophsax reopened this Mar 21, 2017
@christophsax christophsax changed the title SEATS insists on predicting 36 months with xreg NOTE not shown: SEATS insists on predicting 36 months Mar 21, 2017
@christophsax christophsax changed the title NOTE not shown: SEATS insists on predicting 36 months NOTE not shown Mar 21, 2017
@christophsax
Copy link
Owner

fixed in the latest. Now returns the note as it should:

> # external regressor
> cny.ts <- genhol(cny, start = 0, end = 6, center = "calendar")
> 
> # Which has nothing to do with xreg, SEATS just wants to produce a 3 year forecast 
> m3 <- seas(x = imp, forecast.maxlead = 3, series.span=", 2012.9")
> summary(m3)

Call:
seas(x = imp, forecast.maxlead = 3, series.span = ", 2012.9")

Coefficients:
                   Estimate Std. Error z value Pr(>|z|)    
Weekday            0.004407   0.001362   3.236 0.001211 ** 
LS1985.Jan         0.246591   0.059595   4.138 3.51e-05 ***
AO1993.Jan        -0.338741   0.067633  -5.009 5.48e-07 ***
LS2008.Nov        -0.408144   0.059613  -6.847 7.57e-12 ***
AO2009.Jan        -0.288794   0.069114  -4.178 2.93e-05 ***
MA-Nonseasonal-01  0.747718   0.053209  14.053  < 2e-16 ***
MA-Nonseasonal-02 -0.188224   0.053205  -3.538 0.000404 ***
MA-Seasonal-12     0.433278   0.047615   9.100  < 2e-16 ***
---
Signif. codes:  0***0.001**0.01*0.05.0.1 ‘ ’ 1

SEATS adj.  ARIMA: (0 1 2)(0 1 1)  Obs.: 351  Transform: log
AICc:  2834, BIC:  2867  QS (no seasonality in final):    0  
Box-Ljung (no autocorr.): 33.13   Shapiro (normality): 0.9743 ***
Messages generated by X-13:
Notes:
- A longer forecast horizon is required by the SEATS signal
  extraction procedure, so the number of forecasts generated by
  this run has been changed to 36.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants