tramoseats: Seasonal Adjustment with TRAMO-SEATS

View source: R/tramoseats.R

tramoseatsR Documentation

Seasonal Adjustment with TRAMO-SEATS

Description

Functions to estimate the seasonally adjusted series (sa) with the TRAMO-SEATS 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 (TRAMO) step. tramoseats returns a preformatted result while jtramoseats returns the Java objects of the seasonal adjustment.

Usage

jtramoseats(
  series,
  spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"),
  userdefined = NULL
)

tramoseats(
  series,
  spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"),
  userdefined = NULL
)

Arguments

series

an univariate time series

spec

a TRAMO-SEATS model specification. It can be the name (character) of a pre-defined TRAMO-SEATS 'JDemetra+' model specification (see Details), or an object of class c("SA_spec","TRAMO_SEATS"). The default value is "RSAfull".

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 with TRAMO. 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 SEATS 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, in the latter case pre-adjustment and decomposition are performed on (log(y) = log(t) + log(s) + log(i)).

In the TRAMO-SEATS method, the second step - SEATS ("Signal Extraction in ARIMA Time Series") - performs an ARIMA-based decomposition of an observed time series into unobserved components. More information on this method at https://jdemetra-new-documentation.netlify.app/m-seats-decomposition.

The available predefined 'JDemetra+' TRAMO-SEATS 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)
RSA2 | automatic | AO/LS/TC | 2 td vars + Easter | Airline(+mean)
RSA3 | automatic | AO/LS/TC | NA | automatic
RSA4 | automatic | AO/LS/TC | 2 td vars + Easter | automatic
RSA5 | automatic | AO/LS/TC | 7 td vars + Easter | automatic
RSAfull | automatic | AO/LS/TC | automatic | automatic

Value

jtramoseats returns a jSA object that contains the results of the seasonal adjustment without any formatting. Therefore, the computation is faster than with the function tramoseats. The results of the seasonal adjustment can be extracted with the function get_indicators.

tramoseats returns an object of class c("SA","TRAMO_SEATS"), that is, a list containing :

regarima

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

decomposition

an object of class "decomposition_SEATS", that is a five-element list:

  • specification a list with the SEATS algorithm specification. See also the function tramoseats_spec.

  • mode the decomposition mode

  • model the SEATS model list: model, sa, trend, seasonal, transitory, irregular, each element being a matrix of estimated coefficients.

  • linearized the time series matrix (mts) with the stochastic series decomposition (input series y_lin, seasonally adjusted series sa_lin, trend t_lin, seasonal s_lin, irregular i_lin)

  • components the time series matrix (mts) with the decomposition components (input series y_cmp, seasonally adjusted series sa_cmp, trend t_cmp, seasonal component s_cmp, irregular i_cmp)

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-element 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/

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

tramoseats_spec, x13

Examples


#Example 1
myseries <- ipi_c_eu[, "FR"]
myspec <- tramoseats_spec("RSAfull")
mysa <- tramoseats(myseries, myspec)
mysa

# Equivalent to:
mysa1 <- tramoseats(myseries, spec = "RSAfull")
mysa1

#Example 2
var1 <- ts(rnorm(length(myseries))*10, start = start(myseries), frequency = 12)
var2 <- ts(rnorm(length(myseries))*100, start = start(myseries), frequency = 12)
var <- ts.union(var1, var2)
myspec2 <- tramoseats_spec(myspec, tradingdays.mauto = "Unused",
                           tradingdays.option = "WorkingDays",
                           easter.type = "Standard",
                           automdl.enabled = FALSE, arima.mu = TRUE,
                           usrdef.varEnabled = TRUE, usrdef.var = var)
s_preVar(myspec2)
mysa2 <- tramoseats(myseries, myspec2,
                    userdefined = c("decomposition.sa_lin_f",
                                    "decomposition.sa_lin_e"))
mysa2
plot(mysa2)
plot(mysa2$regarima)
plot(mysa2$decomposition)


RJDemetra documentation built on Oct. 19, 2023, 1:12 a.m.