x13: Seasonal Adjustment with X13-ARIMA

View source: R/x13.R

x13R Documentation

Seasonal Adjustment with X13-ARIMA

Description

Functions to estimate the seasonally adjusted series (sa) with the X13-ARIMA method. This is achieved by decomposing the time series (y) into the trend-cycle (t), the seasonal component (s) and the irregular component (i). Calendar-related movements can be corrected in the pre-treatment (regarima) step. x13 returns a preformatted result while jx13 returns the Java objects resulting from the seasonal adjustment.

Usage

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

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

Arguments

series

an univariate time series

spec

the x13 model specification. It can be the name (character) of a pre-defined X13 'JDemetra+' model specification (see Details) or of a specification created with the x13_spec function. The default value is "RSA5c".

userdefined

a character vector containing the additional output variables (see user_defined_variables).

Details

The first step of a seasonal adjustment consists in pre-adjusting the time series. This is done by removing its deterministic effects (calendar and outliers), using a regression model with ARIMA noise (RegARIMA, see: regarima). In the second part, the pre-adjusted series is decomposed by the X11 algorithm into the following components: trend-cycle (t), seasonal component (s) and irregular component (i). The decomposition can be: additive (y = t + s + i) or multiplicative (y = t * s * i). More information on the X11 algorithm at https://jdemetra-new-documentation.netlify.app/m-x11-decomposition.

The available pre-defined 'JDemetra+' X13 model specifications 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
RSA5c | automatic | AO/LS/TC | 7 td vars + Easter | automatic
X11 | NA | NA | NA | NA

Value

jx13 returns the result of the seasonal adjustment in a Java (jSA) object, without any formatting. Therefore, the computation is faster than with the x13 function. The results of the seasonal adjustment can be extracted with the function get_indicators.

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

regarima

an object of class c("regarima","X13"). More info in the Value section of the function regarima.

decomposition

an object of class "decomposition_X11", that is a six-element list:

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

  • mode the decomposition mode

  • mstats the matrix with the M statistics

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

  • s_filter the seasonal filters

  • t_filter the trend filter

final

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

diagnostics

an object of class "diagnostics", that is a list containing three types of tests results:

  • variance_decomposition a data.frame with the tests results 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 a data.frame with the tests results of the presence of seasonality in the residuals (including the statistic test values, the corresponding p-values and the parameters description);

  • combined_test the combined tests for stable seasonality in the entire series. The format is a two elements list with: tests_for_stable_seasonality, a data.frame containing the tests results (including the statistic test value, its p-value and the parameters description), and combined_seasonality_test, the summary.

user_defined

an object of class "user_defined": a list containing the additional userdefined variables.

References

More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/

See Also

x13_spec, tramoseats

Examples


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)


RJDemetra documentation built on Oct. 1, 2024, 5:07 p.m.