RJDemetra (version 0.1.3)

x13: Seasonal Adjustment with X-13ARIMA-SEATS

Description

Functions to estimate the seasonally adjusted series (sa) with the X-13ARIMA-SEATS method. This is achieved by decomposing the time series (y) into the: trend-cycle (t), seasonal component (s) and irregular component (i). The final seasonally adjusted series shall be free of seasonal and calendar-related movements. x13 returns a preformatted result while jx13 returns the Java objects of the seasonal adjustment.

Usage

jx13(series, spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3", "RSA4c"),
  userdefined = NULL)

x13(series, spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3", "RSA4c"), userdefined = NULL)

Arguments

series

a univariate time series

spec

model specification X13. It can be a character of predefined X13 'JDemetra+' model specification (see Details), or an object of class c("SA_spec","X13"). The default is "RSA5c".

userdefined

vector with characters for additional output variables (see user_defined_variables).

Value

jx13 returns a jSA object. It contains the Java objects of the result of the seasonal adjustment without any formatting. Therefore the computation is faster than with x13. The results can the seasonal adjustment can be extract by get_indicators.

x13 returns an object of class c("SA","X13"), a list containing the following components:

regarima

object of class c("regarima","X13"). See Value of the function regarima.

decomposition

object of class "decomposition_X11", six elements list:

  • specification list with the X11 algorithm specification. See also function x13_spec

  • mode decomposition mode

  • mstats matrix with the M statistics

  • si_ratio time series matrix (mts) with the d8 and d10 series

  • s_filter seasonal filters

  • t_filter trend filter

final

object of class c("final","mts","ts","matrix"). Matrix with the final results of the seasonal adjustment. It includes time series: original time series (y), forecast of the original series (y_f), trend (t), forecast of the trend (t_f), seasonally adjusted series (sa), forecast of the seasonally adjusted series (sa_f), seasonal component (s), forecast of the seasonal component (s_f), irregular component (i) and the forecast of the irregular component (i_f).

diagnostics

object of class "diagnostics", list with three type of diagnostics tests:

  • variance_decomposition data.frame with the tests on the relative contribution of the components to the stationary portion of the variance in the original series, after the removal of the long term trend.

  • residuals_test data.frame with the tests on the presence of seasonality in the residuals (includes the statistic, p-value and parameters description)

  • combined_test combined tests for stable seasonality in the entire series. Two elements list with: tests_for_stable_seasonality - data.frame with the tests (includes the statistic, p-value and parameters description) and combined_seasonality_test - the summary.

user_defined

object of class "user_defined". List containing the userdefined additional variables defined in the userdefined argument.

Details

The first step of the seasonal adjustment consist of pre-adjusting the time series by removing from it the deterministic effects by means of a regression model with ARIMA noise (RegARIMA, see: regarima). In the second part, the pre-adjusted series is decomposed into the following components: trend-cycle (t), seasonal component (s) and irregular component (i). The decomposition can be: additive (\(y = t + s + i\)), multiplicative (\(y = t * s * i\)), log-additive (\(log(y) = log(t)+log(s)+log(i)\)) or pseudo-additive (\(y = t*(s+i-1)\)). The final seasonally adjusted series (sa) shall be free of seasonal and calendar-related movements.

In the X13 method, the X11 algorithm (second step) decomposes the time series by means of linear filters. More information on the method can be found on the U.S. Census Bureau website.

As regards the available predefined 'JDemetra+' X13 model specifications, they are described in the table below.

Identifier | Log/level detection | Outliers detection | Calendar effects | ARIMA RSA0 | NA |
NA | NA | Airline(+mean) RSA1 | automatic | AO/LS/TC | NA |
Airline(+mean) RSA2c | automatic | AO/LS/TC | 2 td vars + Easter | Airline(+mean) RSA3 |
automatic | AO/LS/TC | NA | automatic RSA4c | automatic | AO/LS/TC |
2 td vars + Easter | automatic Identifier | Log/level detection | Outliers detection | Calendar effects | ARIMA

References

Info on 'JDemetra+', usage and functions: https://ec.europa.eu/eurostat/cros/content/documentation_en

BOX G.E.P. and JENKINS G.M. (1970), "Time Series Analysis: Forecasting and Control", Holden-Day, San Francisco.

BOX G.E.P., JENKINS G.M., REINSEL G.C. and LJUNG G.M. (2015), "Time Series Analysis: Forecasting and Control", John Wiley & Sons, Hoboken, N. J., 5th edition.

See Also

x13_spec, tramoseats

Examples

Run this code
# NOT RUN {
myseries <- ipi_c_eu[, "FR"]
mysa <- x13(myseries, spec = "RSA5c")

myspec1 <- x13_spec(mysa, tradingdays.option = "WorkingDays",
            usrdef.outliersEnabled = TRUE,
            usrdef.outliersType = c("LS","AO"),
            usrdef.outliersDate = c("2008-10-01", "2002-01-01"),
            usrdef.outliersCoef = c(36, 14),
            transform.function = "None")
mysa1 <- x13(myseries, myspec1)
mysa1
summary(mysa1$regarima)

myspec2 <- x13_spec(mysa, automdl.enabled =FALSE,
            arima.coefEnabled = TRUE,
            arima.p = 1, arima.q = 1, arima.bp = 0, arima.bq = 1,
            arima.coef = c(-0.8, -0.6, 0),
            arima.coefType = c(rep("Fixed", 2), "Undefined"))
s_arimaCoef(myspec2)
mysa2 <- x13(myseries, myspec2,
             userdefined = c("decomposition.d18", "decomposition.d19"))
mysa2
plot(mysa2)
plot(mysa2$regarima)
plot(mysa2$decomposition)
# }

Run the code above in your browser using DataLab