robust.seas: A Robust Version of 'seas' that _Always_ Works (Experimental)

Description Usage Arguments Details Value See Also Examples

Description

robust.seas has exactly the same usage as seas, the main function of seasonal, but will always work. If seas is failing, robust.seas tries an an alternative specification, and returns a message. robust.seas currently works with all 3000+ series of the M3 forecast competition.

Usage

1

Arguments

...

arguments passed on to seas.

Details

If seas fails, robust.seas tries the following:

  1. adjusting invalid start year

  2. increasing maxiter to 10000 (if suggested in the error)

  3. switch to X-11

  4. fix model to (0 1 1)(0 1 1)

  5. turn off AIC testing

  6. turn off outlier detection

If robust.seas is applied to annual series (in which case you do not need seasonal adjustment), it will proceed slightly different:

  1. adjusting invalid start year

  2. ensure SEATS, X11 and AIC testing are off

  3. turn off outlier detection

  4. fix model to (1 1 0)

If it still fails, it will return an error, along with the suggestion to post the example on: https://github.com/christophsax/seasonal/wiki/Breaking-Examples-(and-Possible-Solutions).

Value

returns an object of class "seas".

See Also

seas for the main function of seasonal.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Not run: 
 
x <- ts(1:40)  # an annual time series with an invalid start year

# not working
seas(x)

# working
robust.seas(x)


### X-13 in the  IJF-M3 forecast competition

# Original analysis by Peter Ellis
# http://ellisp.github.io/blog/2015/12/21/m3-and-x13/

library(Mcomp)     # IJF-M3 forecast competition data
library(parallel)  # part of R base, but needs to be loaded

# using cluster parallelization, which also works on Windows 
# (on Linux and Mac, you could simply use mclapply)

# a) set up cluster
cl <- makeCluster(detectCores())

# b) load 'seasonal' and 'Mcomp' for each node
clusterEvalQ(cl, {library(seasonal); library(Mcomp)})

# c) run in parallel (60 sec on an older Macbook Pro with 8 cores)
ff <- function(e){
  m <- robust.seas(e$x, forecast.save = "fct", forecast.maxlead = 18, seats = NULL)
  series(m, "forecast.forecasts")[, 1]
}
lx13 <- parLapply(cl, M3, ff)

# d) stop the cluster
stopCluster(cl)


## End(Not run)

christophsax/seasonallab documentation built on May 13, 2019, 7:05 p.m.