Learn R Programming

RJDemetra (version 0.1.1)

tramoseats: Seasonal Adjustment with TRAMO-SEATS

Description

tramoseats/tramoseats_def estimates the seasonally adjusted series (sa) with the TRAMO-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.

Usage

tramoseats(series, spec, userdefined = NULL)

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

Arguments

series

a univariate time series

spec

model specification TRAMO-SEATS. For the function:

  • tramoseats, object of class c("SA_spec","TRAMO_SEATS")

  • tramoseats_def, predefined TRAMO-SEATS 'JDemetra+' model specification (see Details). The default is "RSAfull".

userdefined

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

Value

tramoseats/tramoseats_def returns an object of class c("SA","TRAMO_SEATS"), a list containing the following components:

regarima

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

decomposition

object of class "decomposition_SEATS", five elements list:

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

  • mode decomposition mode

  • model list with the SEATS models: model, sa, trend, seasonal, transitory, irregular. Each of them is a matrix with the estimated coefficients.

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

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

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.

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\)) or multiplicative (\(y = t * s * i\)). The final seasonally adjusted series (sa) shall be free of seasonal and calendar-related movements.

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 the method can be found on the Bank of Spian website (www.bde.es).

As regards the available predefined 'JDemetra+' TRAMO-SEATS model specifications (for the function tramoseats_def), they are described in the table below.

Identifier | Log/level detection | Outliers detection | Calender 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 Identifier | Log/level detection | Outliers detection | Calender 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

tramoseats_spec, x13

Examples

Run this code
# NOT RUN {
myseries <- ipi_c_eu[, "FR"]
myspec <- tramoseats_spec_def("RSAfull")
mysa <- tramoseats(myseries, myspec)
mysa

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

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)
# }

Run the code above in your browser using DataLab