seastests - Seasonality tests"

  collapse = TRUE,
  comment = "#>"

Seasonality tests

Different authors have developed a multiplicity of test for seasonality of a given time series. In Ollech and Webel (forthcoming) and Webel and Ollech (forthcoming) we analysed many of these tests and showed a) which tests are the most reliable ones and b) how to combine a small set of tests, to reduce the misclassification rates of the single tests.

To get started

We'll simulated simple non-seasonal and a seasonal series.

x1 = 1:96/20 + ts(rnorm(96, 100, 1), start=c(2015,1), frequency=12)
x2 = 1:96/20 + ts(rnorm(96, 100, 1) + ts(sin((2*pi*rep(1:12, 8))/12), frequency=12), start=c(2015,1), frequency=12)

ts.plot(x1,x2, col=c("darkblue", "darkred"), main="Some simple seasonal series")
legend("topleft", c("Non seasonal series", "Seasonal series"), col=c("darkblue", "darkred"), lty=1)

Then, we can test, whether these series are seasonal or not, using the WO-test, i.e. the overall seasonality test developed in Webel and Ollech (2019).

print("Testing the non-seasonal series")
print("Testing the seasonal series")

The WO-test gives out a TRUE if the series is seasonal and FALSE otherwise. The p-values indicate the p-values of the underlying test, i.e. the QS-test, the QS-R test and the KW-R-test.

If we are only interested in knowing, whether a series is seasonal or not, e.g. for further use in our analysis, the function isSeasonal() can be called.

print("Test using the non-seasonal series")
print("Test using the seasonal series")

This can then for example be used in the forecast packages auto.arima() function. For the non-seasonal series:

if (!require("forecast")) install.packages("forecast")

mod1 <- auto.arima(x1, seasonal=isSeasonal(x1))
plot(forecast(mod1, h=12))

and for the seasonal series:

mod2 <- auto.arima(x2, seasonal=isSeasonal(x2))
plot(forecast(mod2, h=12))


Ollech, Daniel and Webel, Karsten (forthcoming). A random forest-based approach to identifying the most informative seasonality tests. Bundesbank Discussion Paper Webel, Karsten and Ollech, Daniel (forthcoming). An overall seasonality test. Bundesbank Discussion Paper

Try the seastests package in your browser

Any scripts or data that you put into this service are public.

seastests documentation built on May 2, 2019, 2:37 a.m.