feasts icon indicating copy to clipboard operation
feasts copied to clipboard

specifying "mode" argument in X_13ARIMA_SEATS using x11()

Open juan-g-p opened this issue 2 years ago • 4 comments

I am trying to get x11 to perform an additive rather than a multiplicative decomposition. The us_retail_employment series in Hyndman's fpp3 (section 3.5) is clearly additive, nonetheless the x11 decomposition performed on the book is multiplicative (below the code of the book)

x11_dcmp <- us_retail_employment %>% model(x11 = X_13ARIMA_SEATS(Employed ~ x11())) %>% components() autoplot(x11_dcmp) + labs(title = "Decomposition of total US retail employment using X-11.")

Checking the manual (https://www2.census.gov/software/x-13arima-seats/x-13-data/documentation/docx13as.pdf), it says that x11 uses by default multiplicative, but that this can be changed to additive specifying mode = add. I have tried this and multiple variations, could you please provide some insight as to how to properly specify the formula?

x11_dcmp <- us_retail_employment %>% model(x11 = X_13ARIMA_SEATS(Employed ~ transform(func = "none"), x11(mode = "add")))

juan-g-p avatar Mar 04 '22 10:03 juan-g-p

Each of the 'specials' in the model should be added to the formula.

So instead of X_13ARIMA_SEATS(Employed ~ transform(func = "none"), x11(mode = "add")), it should be X_13ARIMA_SEATS(Employed ~ transform(func = "none") + x11(mode = "add")). You also need to match the reference manuals argument names exactly, so it should be transform(`function` = "none").

@robjhyndman Do you think the fpp3 should be updated to use an additive decomposition in X11 example?

mitchelloharawild avatar Mar 04 '22 11:03 mitchelloharawild

Thank you for the great and prompt answer, as well as for the great materials you provide.

I was missing the backticks in one of my attempts.

If there is any way to contribute to your project I would be happy to.

juan-g-p avatar Mar 04 '22 11:03 juan-g-p

You're welcome. The backticks are tricky for this, because of course function has special parsing for creating functions in R. However I do think it is important to match the reference manual as close as possible.

More than happy for you to contribute to the package if you would like to. Plenty of work to be done for the function help docs, writing vignettes & package tests. If you're working with X_13ARIMA_SEATS and into coding, adding refit() support would be really nice and hopefully not too challenging to wrap around seasonal::update.seas() (https://github.com/tidyverts/feasts/issues/140)

mitchelloharawild avatar Mar 04 '22 11:03 mitchelloharawild

I think it would be better if the help showed an additive model for X_13ARIMA_SEATS. I'll update the book to state that the default is a multiplicative decomposition. For the example shown, it doesn't make much difference whether an additive or multiplicative decomposition is used, and I'd like to keep the code as simple as possible.

robjhyndman avatar Mar 06 '22 21:03 robjhyndman