| Title: | Seasonal Adjustment with TRAMO-SEATS in 'JDemetra+' 3.x |
|---|---|
| Description: | Interface to 'JDemetra+' 3.x (<https://github.com/jdemetra>) time series analysis software. It offers full access to options and outputs of 'TRAMO-SEATS' (Time series Regression with ARIMA noise, Missing values and Outliers - Signal Extraction in ARIMA Time Series), including 'TRAMO' modelling (ARIMA model with outlier detection and trading days adjustment). ARIMA = AutoRegressive Integrated Moving Average. |
| Authors: | Jean Palate [aut], Alain Quartier-la-Tente [aut] (ORCID: <https://orcid.org/0000-0001-7890-3857>), Tanguy Barthelemy [aut, cre, art], Anna Smyk [aut] |
| Maintainer: | Tanguy Barthelemy <[email protected]> |
| License: | EUPL |
| Version: | 3.7.1.9000 |
| Built: | 2026-06-03 18:26:56 UTC |
| Source: | https://github.com/rjdverse/rjd3tramoseats |
Deprecated functions
fast_tramoseats( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL ) fast_tramo( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), context = NULL, userdefined = NULL ) spec_tramoseats( name = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5") ) spec_tramo(name = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5")) userdefined_variables_tramoseats(x = c("TRAMO-SEATS", "TRAMO"))fast_tramoseats( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL ) fast_tramo( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), context = NULL, userdefined = NULL ) spec_tramoseats( name = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5") ) spec_tramo(name = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5")) userdefined_variables_tramoseats(x = c("TRAMO-SEATS", "TRAMO"))
ts |
a univariate time series. |
spec |
the model specification. Can be either the name of a predefined specification or a user-defined specification. |
context |
the dictionary of variables. |
userdefined |
a vector containing the additional output variables
(see |
name |
the name of a predefined specification. |
x |
useless parameter |
All these functions are deprecated and return the same value as the function that replaces them:
spec_tramoseats() returns the same value as tramoseats_spec()
spec_tramo() returns the same value as tramo_spec()
fast_tramoseats() returns the same value as tramoseats_fast()
fast_regarima() returns the same value as regarima_fast()
.jtramoseats() returns the same value as jtramoseats()
userdefined_variables_tramoseats() returns the same value as tramoseats_dictionary()
These functions are used in all JDemetra+ 3.0 packages to easily interact between R and Java objects.
.tramoseats_rslts(jrslts) .jd2r_spec_tramo(jspec) .r2jd_spec_tramo(spec) .jd2r_spec_tramoseats(jspec) .r2jd_spec_tramoseats(spec).tramoseats_rslts(jrslts) .jd2r_spec_tramo(jspec) .r2jd_spec_tramo(spec) .jd2r_spec_tramoseats(jspec) .r2jd_spec_tramoseats(spec)
spec, jspec, jrslts
|
parameters. |
These functions return specification in Java, proto or R.
Functions tramoseats_refresh and tramo_refresh allow to create a new
specification by updating an existing one.
Some selected parameters will be kept fixed while others will be freed within the boundaries of a
reference specification. In practice each freed parameter of the specification to be updated
(spec) is replaced by the corresponding parameter of the reference specification (refspec).
See details and examples.
tramo_refresh( spec, refspec = NULL, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed", "Current"), period = 0, start = NULL, end = NULL ) tramoseats_refresh( spec, refspec = NULL, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed", "Current"), period = 0, start = NULL, end = NULL )tramo_refresh( spec, refspec = NULL, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed", "Current"), period = 0, start = NULL, end = NULL ) tramoseats_refresh( spec, refspec = NULL, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed", "Current"), period = 0, start = NULL, end = NULL )
spec |
specification to be refreshed
Object of class "JD3_tramoseats_SPEC" or "JD3_tramo_SPEC",
can be obtained as an output of |
refspec |
reference specification
By default |
policy |
refresh policy to apply (see details) |
period, start, end
|
additional parameters used to specify the span
when |
A particular selection of parameters to be kept fixed or re-estimated is called a revision policy.
Available refresh policies are:
Current: applying the current pre-adjustment reg-arima model and handling the new raw data points, or any sub-span of the series as Additive Outliers (defined as new intervention variables); SEATS and Benchmarking part parameters are untouched.
Fixed: applying the current pre-adjustment reg-arima model and replacing forecasts by new raw data points; SEATS and Benchmarking part parameters are untouched.
FixedParameters: pre-adjustment reg-arima model is partially modified: regression coefficients will be re-estimated but regression variables, Arima orders and coefficients are unchanged;
FixedAutoRegressiveParameters: same as FixedParameters but Arima Moving Average coefficients (MA) are also re-estimated, Auto-regressive (AR) coefficients are kept fixed; SEATS and Benchmarking part parameters are untouched.
FreeParameters: all regression and Arima model coefficients are re-estimated, regression variables and Arima orders are kept fixed; SEATS and Benchmarking part parameters are untouched.
Outliers: regression variables and Arima orders are kept fixed, but outliers will be re-detected on the defined span, thus all regression and Arima model coefficients are re-estimated; SEATS and Benchmarking part parameters are untouched.
Outliers_StochasticComponent: same as "Outliers" but Arima model orders (p,d,q)(P,D,Q) can also be re-identified; SEATS and Benchmarking part parameters are untouched.
Complete: All the parameters are re-identified and re-estimated, unless constrained in the domain spec. SEATS and Benchmarking part parameters are entirely reset to values in the reference spec.
a new specification, an object of class "JD3_tramoseats_SPEC" or
"JD3_tramo_SPEC".
More information on revision policies in JDemetra+ documentation: https://doc.jdemetra.org/a-rev-policies
library("rjd3toolkit") y <- rjd3toolkit::ABS$X0.2.08.10.M # raw series for first estimation y_raw <- window(y, end = c(2016, 12)) # raw series for second (refreshed) estimation: new data points y_new <- window(y, end = c(2017, 6)) # Example 1 : refresh mechanism # Create reference spec, here the default "rsa3" rsa3<- tramoseats_spec("rsa3") # Customize this spec ## Tramo part ### For example, disable automatic arima modelling user_spec <- set_automodel(rsa3, enabled = FALSE) ### set a user-defined arima model user_spec <- set_arima( user_spec, mean = 0.2, mean.type = "Fixed", p = 1, d = 2, q = 0, bp = 1, bd = 1, bq = 0, coef = c(0.6, 0.7), coef.type = c("Initial", "Fixed") ) #print(user_spec) ## Customize the x11 part user_spec<-set_seats(user_spec, fcasts = -2, bcasts = -1, trend.boundary=0.6, seas.boundary=0.75, algorithm= "KalmanSmoother") #print(user_spec) user_spec<- set_benchmarking( user_spec, enabled = TRUE, target = "Original", rho = 0.7, lambda = 0.5, forecast = TRUE, bias = "Multiplicative") #print(user_spec) # Use policy: "Outliers_StochasticComponent" tramoseats_spec_ref <- tramoseats_refresh(spec= user_spec, refspec= rsa3, policy = "Outliers_StochasticComponent" ) # print(tramoseats_spec_ref) # user defined reg-arima model is reset and outliers will be re-identified # on the whole series as no start and end specified, SEATS and Benchmarking parameters # are left unchanged # Use policy: "Complete" tramoseats_spec_ref <- tramoseats_refresh(spec= user_spec, refspec= rsa3, policy = "Complete" ) # print(tramoseats_spec_ref) # all user defined parameters are reset and replaced with "rsa3" parameters, # Example 2 : practical re-estimation use-case sa_tramoseats <- tramoseats(y_raw, user_spec) # refreshing the specification resulting from the first estimation # to partially adapt to new data spec_to_refresh <- sa_tramoseats$result_spec reference_spec <- sa_tramoseats$estimation_spec # policy = "Fixed" spec_tramoseats_ref <- tramoseats_refresh(spec_to_refresh, reference_spec, policy = "Fixed" ) # 2nd estimation with refreshed specification sa_tramoseats_ref <- tramoseats(y_new, spec_tramoseats_ref) # policy = "Outliers" spec_tramoseats_ref <- tramoseats_refresh(spec_to_refresh, reference_spec, policy = "Outliers", period = 12, start = c(2017, 1) ) # outliers will be re-detected from January 2017 included # 2nd estimation with refreshed specification sa_tramoseats_ref <- tramoseats(y_new, spec_tramoseats_ref) # policy = "Current" spec_tramoseats_ref <- tramoseats_refresh(spec_to_refresh, reference_spec, policy = "Current", period = 12, start = c(2017, 1), end = end(y_new) ) sa_tramoseats_ref <- tramoseats(y_new, spec_tramoseats_ref) # Points from January 2017 (included) until the end of the series will be # treated as Additive Outliers, the previous reg-Arima model being otherwise # kept fixed 2nd estimation with refreshed specificationlibrary("rjd3toolkit") y <- rjd3toolkit::ABS$X0.2.08.10.M # raw series for first estimation y_raw <- window(y, end = c(2016, 12)) # raw series for second (refreshed) estimation: new data points y_new <- window(y, end = c(2017, 6)) # Example 1 : refresh mechanism # Create reference spec, here the default "rsa3" rsa3<- tramoseats_spec("rsa3") # Customize this spec ## Tramo part ### For example, disable automatic arima modelling user_spec <- set_automodel(rsa3, enabled = FALSE) ### set a user-defined arima model user_spec <- set_arima( user_spec, mean = 0.2, mean.type = "Fixed", p = 1, d = 2, q = 0, bp = 1, bd = 1, bq = 0, coef = c(0.6, 0.7), coef.type = c("Initial", "Fixed") ) #print(user_spec) ## Customize the x11 part user_spec<-set_seats(user_spec, fcasts = -2, bcasts = -1, trend.boundary=0.6, seas.boundary=0.75, algorithm= "KalmanSmoother") #print(user_spec) user_spec<- set_benchmarking( user_spec, enabled = TRUE, target = "Original", rho = 0.7, lambda = 0.5, forecast = TRUE, bias = "Multiplicative") #print(user_spec) # Use policy: "Outliers_StochasticComponent" tramoseats_spec_ref <- tramoseats_refresh(spec= user_spec, refspec= rsa3, policy = "Outliers_StochasticComponent" ) # print(tramoseats_spec_ref) # user defined reg-arima model is reset and outliers will be re-identified # on the whole series as no start and end specified, SEATS and Benchmarking parameters # are left unchanged # Use policy: "Complete" tramoseats_spec_ref <- tramoseats_refresh(spec= user_spec, refspec= rsa3, policy = "Complete" ) # print(tramoseats_spec_ref) # all user defined parameters are reset and replaced with "rsa3" parameters, # Example 2 : practical re-estimation use-case sa_tramoseats <- tramoseats(y_raw, user_spec) # refreshing the specification resulting from the first estimation # to partially adapt to new data spec_to_refresh <- sa_tramoseats$result_spec reference_spec <- sa_tramoseats$estimation_spec # policy = "Fixed" spec_tramoseats_ref <- tramoseats_refresh(spec_to_refresh, reference_spec, policy = "Fixed" ) # 2nd estimation with refreshed specification sa_tramoseats_ref <- tramoseats(y_new, spec_tramoseats_ref) # policy = "Outliers" spec_tramoseats_ref <- tramoseats_refresh(spec_to_refresh, reference_spec, policy = "Outliers", period = 12, start = c(2017, 1) ) # outliers will be re-detected from January 2017 included # 2nd estimation with refreshed specification sa_tramoseats_ref <- tramoseats(y_new, spec_tramoseats_ref) # policy = "Current" spec_tramoseats_ref <- tramoseats_refresh(spec_to_refresh, reference_spec, policy = "Current", period = 12, start = c(2017, 1), end = end(y_new) ) sa_tramoseats_ref <- tramoseats(y_new, spec_tramoseats_ref) # Points from January 2017 (included) until the end of the series will be # treated as Additive Outliers, the previous reg-Arima model being otherwise # kept fixed 2nd estimation with refreshed specification
SEATS Decomposition
seats_decompose( sarima, seas.tolerance = 2, trend.boundary = 0.5, seas.boundary = 0.8, seas.boundary.unique = 0.8, approximation = c("None", "Legacy", "Noisy") )seats_decompose( sarima, seas.tolerance = 2, trend.boundary = 0.5, seas.boundary = 0.8, seas.boundary.unique = 0.8, approximation = c("None", "Legacy", "Noisy") )
sarima |
SARIMA model (see |
seas.tolerance |
numeric: the seasonal tolerance (epsphi). The tolerance (measured in degrees) to allocate the AR non-real roots to the seasonal component (if the modulus of the inverse complex AR root is greater than the trend boundary and the frequency of this root differs from one of the seasonal frequencies by less than Seasonal tolerance) or the transitory component (otherwise). Possible values in [0,10]. Default value 2. |
trend.boundary |
numeric: the trend boundary (rmod). The boundary beyond which an AR root is integrated in the trend component. If the modulus of the inverse real root is greater than the trend boundary, the AR root is integrated in the trend component. Below this value, the root is integrated in the transitory component. Possible values [0,1]. Default = 0.5. |
seas.boundary |
numeric: the seasonal boundary (sbound). The boundary beyond which a real negative AR root is integrated in the seasonal component. If the modulus of the inverse negative real root is greater (or equal) than Seasonal boundary, the AR root is integrated into the seasonal component. Otherwise the root is integrated into the trend or transitory component. Possible values [0,1]. Default=0.8. |
seas.boundary.unique |
numeric: the seasonal boundary (unique), (sboundatpi). The boundary beyond which a negative AR root is integrated in the seasonal component, when the root is the unique seasonal root. If the modulus of the inverse negative real root is greater (or equal) than Seasonal boundary, the AR root is integrated into the seasonal component. Otherwise the root is integrated into the trend or transitory component. Possible values [0,1]. Default=0.8. |
approximation |
character: the approximation mode.
When the ARIMA model estimated by TRAMO does not accept an admissible
decomposition, SEATS:
|
returns a "JD3_UCARIMA" object
seats_decompose(rjd3toolkit::sarima_model(period = 12, phi = c(0, 1), bd = 1))seats_decompose(rjd3toolkit::sarima_model(period = 12, phi = c(0, 1), bd = 1))
Function allowing to customize parameters in the decomposition part (Seats) of a Tramo-Seats seasonal adjustment process. (Seats is an Arima Model Based decomposition algorithm working in conjunction with Tramo.)
set_seats( x, approximation = c(NA, "None", "Legacy", "Noisy"), trend.boundary = NA, seas.boundary = NA, seas.boundary.unique = NA, seas.tolerance = NA, ma.boundary = NA, fcasts = NA, bcasts = NA, algorithm = c(NA, "Burman", "KalmanSmoother"), bias = NA )set_seats( x, approximation = c(NA, "None", "Legacy", "Noisy"), trend.boundary = NA, seas.boundary = NA, seas.boundary.unique = NA, seas.tolerance = NA, ma.boundary = NA, fcasts = NA, bcasts = NA, algorithm = c(NA, "Burman", "KalmanSmoother"), bias = NA )
x |
the specification to be modified, object of class |
approximation |
character: the approximation mode.
When the ARIMA model estimated by TRAMO does not accept an admissible
decomposition, SEATS:
|
trend.boundary |
numeric: the trend boundary (rmod). The boundary beyond which an AR root is integrated in the trend component. If the modulus of the inverse real root is greater than the trend boundary, the AR root is integrated in the trend component. Below this value, the root is integrated in the transitory component. Possible values [0,1]. Default = 0.5. |
seas.boundary |
numeric: the seasonal boundary (sbound). The boundary beyond which a real negative AR root is integrated in the seasonal component. If the modulus of the inverse negative real root is greater (or equal) than Seasonal boundary, the AR root is integrated into the seasonal component. Otherwise the root is integrated into the trend or transitory component. Possible values [0,1]. Default=0.8. |
seas.boundary.unique |
numeric: the seasonal boundary (unique), (sboundatpi). The boundary beyond which a negative AR root is integrated in the seasonal component, when the root is the unique seasonal root. If the modulus of the inverse negative real root is greater (or equal) than Seasonal boundary, the AR root is integrated into the seasonal component. Otherwise the root is integrated into the trend or transitory component. Possible values [0,1]. Default=0.8. |
seas.tolerance |
numeric: the seasonal tolerance (epsphi). The tolerance (measured in degrees) to allocate the AR non-real roots to the seasonal component (if the modulus of the inverse complex AR root is greater than the trend boundary and the frequency of this root differs from one of the seasonal frequencies by less than Seasonal tolerance) or the transitory component (otherwise). Possible values in [0,10]. Default value 2. |
ma.boundary |
numeric: the MA unit root boundary. When the modulus of an estimated MA root falls in the range [xl, 1], it is set to xl. Possible values [0.9,1]. Default=0.95. |
bcasts, fcasts
|
numeric: the number of backasts ( |
algorithm |
character: the estimation method for the unobserved components. The choice can be made from:
|
bias |
boolean. If |
an object of class "JD3_TRAMOSEATS_SPEC".
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
init_spec <- tramoseats_spec("rsafull") new_spec <- set_seats(init_spec, approximation = "Legacy", trend.boundary = 0.8, seas.boundary = 0.5, fcasts = -3, algorithm = "KalmanSmoother", bias = TRUE ) y <- rjd3toolkit::ABS$X0.2.09.10.M sa <- tramoseats(y, spec = new_spec)init_spec <- tramoseats_spec("rsafull") new_spec <- set_seats(init_spec, approximation = "Legacy", trend.boundary = 0.8, seas.boundary = 0.5, fcasts = -3, algorithm = "KalmanSmoother", bias = TRUE ) y <- rjd3toolkit::ABS$X0.2.09.10.M sa <- tramoseats(y, spec = new_spec)
TRAMO for ERRORs (TERROR) controls the quality of the data by checking outliers at the end of the series
terror( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), nback = 1, context = NULL )terror( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), nback = 1, context = NULL )
ts |
a univariate time series. |
spec |
the model specification. Can be either the name of a predefined specification or a user-defined specification. |
nback |
number of last observations considered for the quality check. |
context |
the dictionary of variables. |
a mts object with 7 variables:
actual: the actual data at the end of the series;
forecast: the forecast of the actual data at the end of the series;
error: the absolute errors (= observed - forecasts);
rel.error: relative errors ("scores") : ratios between the forecast errors and the standard deviation of the forecasts of the last observations (positive values mean under-estimation);
raw: the transformed series. More especially, if the chosen model implies a log-transformation, the values are obtained after a log-transformation. Other transformations, such leap year corrections or length-of periods corrections may also be used;
fraw: the forecast of the transformed series.;
efraw: the absolute errors of the transformed series.
terror(rjd3toolkit::ABS$X0.2.09.10.M, nback = 2)terror(rjd3toolkit::ABS$X0.2.09.10.M, nback = 2)
allows to model the series with a Reg-Arima model, estimate outlier, calendar or other regression effects and produce forecasts
tramo( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), context = NULL, userdefined = NULL ) tramo_fast( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), context = NULL, userdefined = NULL )tramo( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), context = NULL, userdefined = NULL ) tramo_fast( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), context = NULL, userdefined = NULL )
ts |
a univariate time series. |
spec |
the model specification. Can be either the name of a predefined specification or a user-defined specification. |
context |
the dictionary of variables. |
userdefined |
a vector containing the additional output variables
(see |
the tramo() function returns a list with the results
("JD3_tramo_rslts" object), the estimation specification and the result
specification, while tramo_fast() is a faster function that only returns
the results.
library("rjd3toolkit") y <- rjd3toolkit::ABS$X0.2.09.10.M sp <- tramo_spec("trfull") sp <- add_outlier(sp, type = c("AO"), c("2015-01-01", "2010-01-01") ) tramo_fast(y, spec = sp) sp <- set_transform( set_tradingdays( set_easter(sp, enabled = FALSE), option = "workingdays" ), fun = "None" ) tramo_fast(y, spec = sp) sp <- set_outlier(sp, outliers.type = c("AO")) tramo_fast(y, spec = sp)library("rjd3toolkit") y <- rjd3toolkit::ABS$X0.2.09.10.M sp <- tramo_spec("trfull") sp <- add_outlier(sp, type = c("AO"), c("2015-01-01", "2010-01-01") ) tramo_fast(y, spec = sp) sp <- set_transform( set_tradingdays( set_easter(sp, enabled = FALSE), option = "workingdays" ), fun = "None" ) tramo_fast(y, spec = sp) sp <- set_outlier(sp, outliers.type = c("AO")) tramo_fast(y, spec = sp)
Forecasts with TRAMO
tramo_forecast( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), nf = -1, context = NULL )tramo_forecast( ts, spec = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5"), nf = -1, context = NULL )
ts |
a univariate time series. |
spec |
the model specification. Can be either the name of a predefined specification or a user-defined specification. |
nf |
the forecasting horizon ( |
context |
the dictionary of variables. |
a mts object with 7 variables:
forecast the forecast of the actual data at the end of the series.
error standard deviation of the forecast.
fraw the forecast of the transformed series.
efraw the standard deviation of the forecast of the transformed series.
tramo_forecast(rjd3toolkit::ABS$X0.2.09.10.M)tramo_forecast(rjd3toolkit::ABS$X0.2.09.10.M)
Tramo is a particular regarima model estimation algorithm, mainly used to linearized the series before performing a decomposition with Seats
tramo_outliers( y, order = c(0L, 1L, 1L), seasonal = c(0L, 1L, 1L), mean = FALSE, X = NULL, X.td = NULL, ao = TRUE, ls = TRUE, tc = FALSE, so = FALSE, cv = 0, ml = FALSE, clean = FALSE )tramo_outliers( y, order = c(0L, 1L, 1L), seasonal = c(0L, 1L, 1L), mean = FALSE, X = NULL, X.td = NULL, ao = TRUE, ls = TRUE, tc = FALSE, so = FALSE, cv = 0, ml = FALSE, clean = FALSE )
y |
the dependent variable (a |
order, seasonal
|
the orders of the ARIMA model. |
mean |
Boolean to include or not the mean. |
X |
user defined regressors (other than calendar). |
X.td |
calendar regressors. |
ao, ls, so, tc
|
Boolean to indicate which type of outliers should be detected. |
cv |
|
ml |
Use of maximum likelihood (otherwise approximation by means of Hannan-Rissanen). |
clean |
Clean missing values at the beginning/end of the series. Regression variables are automatically resized, if need be. |
a "JD3_REGARIMA_OUTLIERS" object.
tramo_outliers(rjd3toolkit::ABS$X0.2.09.10.M)tramo_outliers(rjd3toolkit::ABS$X0.2.09.10.M)
Seasonal Adjustment with TRAMO-SEATS
tramoseats( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL ) tramoseats_fast( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL ) .jtramoseats( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL )tramoseats( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL ) tramoseats_fast( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL ) .jtramoseats( ts, spec = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5"), context = NULL, userdefined = NULL )
ts |
a univariate time series. |
spec |
the model specification. Can be either the name of a predefined specification or a user-defined specification. |
context |
the dictionary of variables. |
userdefined |
a vector containing the additional output variables
(see |
The tramoseats() function returns a list with the results, the
estimation specification and the result specification, while
tramoseats_fast() is a faster function that only returns the results.
The .jtramoseats() functions only results the java object to custom outputs
in other packages (use rjd3toolkit::dictionary() to get the list of
variables and rjd3toolkit::result() to get a specific variable).
library("rjd3toolkit") sp <- tramoseats_spec("rsafull") y <- rjd3toolkit::ABS$X0.2.09.10.M tramoseats(y, spec = sp) tramoseats_fast(y, spec = sp) sp <- add_outlier(sp, type = c("AO"), c("2015-01-01", "2010-01-01") ) sp <- set_transform( set_tradingdays( set_easter(sp, enabled = FALSE), option = "workingdays" ), fun = "None" ) tramoseats(y, spec = sp) tramoseats_fast(y, spec = sp)library("rjd3toolkit") sp <- tramoseats_spec("rsafull") y <- rjd3toolkit::ABS$X0.2.09.10.M tramoseats(y, spec = sp) tramoseats_fast(y, spec = sp) sp <- add_outlier(sp, type = c("AO"), c("2015-01-01", "2010-01-01") ) sp <- set_transform( set_tradingdays( set_easter(sp, enabled = FALSE), option = "workingdays" ), fun = "None" ) tramoseats(y, spec = sp) tramoseats_fast(y, spec = sp)
Functions to provide information for all output objects (series, diagnostics,
parameters) available with tramoseats() function.
tramoseats_dictionary() tramoseats_full_dictionary()tramoseats_dictionary() tramoseats_full_dictionary()
These functions provide lists of output names (series, diagnostics,
parameters) available with the tramoseats() function. These names can be
used to generate customized outputs with the userdefined option of the
tramoseats() function (see examples).
The tramoseats_full_dictionary function provides additional information on
object format and description.
tramoseats_dictionary() returns a character vector containing the
names of all output objects (series, diagnostics, parameters) available with
the tramoseats() function, whereas tramoseats_full_dictionary() returns a
data.frame with format and description, for all the output objects.
# Visualize the dictionary print(tramoseats_dictionary()) summary(tramoseats_dictionary()) # first 10 lines head(tramoseats_full_dictionary(), n = 10) # For more structured information call `View(tramoseats_full_dictionary())` # Extract names of output of interest user_defined_output <- tramoseats_dictionary()[c(65, 95, 135)] user_defined_output # Generate the corresponding output in an estimation y <- rjd3toolkit::ABS$X0.2.09.10.M m <- tramoseats(y, "rsafull", userdefined=user_defined_output) # Retrieve user defined output tail(m$user_defined$ylin) m$user_defined$residuals.kurtosis m$user_defined$sa_f# Visualize the dictionary print(tramoseats_dictionary()) summary(tramoseats_dictionary()) # first 10 lines head(tramoseats_full_dictionary(), n = 10) # For more structured information call `View(tramoseats_full_dictionary())` # Extract names of output of interest user_defined_output <- tramoseats_dictionary()[c(65, 95, 135)] user_defined_output # Generate the corresponding output in an estimation y <- rjd3toolkit::ABS$X0.2.09.10.M m <- tramoseats(y, "rsafull", userdefined=user_defined_output) # Retrieve user defined output tail(m$user_defined$ylin) m$user_defined$residuals.kurtosis m$user_defined$sa_f
Computes revisions history
tramoseats_revisions( ts, spec, data_ids = NULL, ts_ids = NULL, cmp_ids = NULL, context = NULL )tramoseats_revisions( ts, spec, data_ids = NULL, ts_ids = NULL, cmp_ids = NULL, context = NULL )
ts |
The time series used for the estimation. |
spec |
The specification used. |
data_ids |
A |
ts_ids |
A |
cmp_ids |
A |
context |
The context of the specification. |
returns a list
s <- rjd3toolkit::ABS$X0.2.09.10.M sa_mod <- tramoseats(s) data_ids <- list( # Get the coefficient of the trading-day coefficient from 2005-jan list(start = "2005-01-01", id = "regression.td(1)"), # Get the ljung-box statistics on residuals from 2010-jan list(start = "2010-01-01", id = "residuals.lb") ) ts_ids <- list( # Get the SA component estimates of 2010-jan from 2010-jan list(period = "2010-01-01", start = "2010-01-01", id = "sa"), # Get the irregular component estimates of 2010-jan from 2015-jan list(period = "2010-01-01", start = "2015-01-01", id = "i") ) cmp_ids <- list( # Get the SA component estimates (full time series) 2010-jan to 2020-jan list(start = "2010-01-01", end = "2020-01-01", id = "sa"), # Get the trend component estimates (full time series) 2010-jan to 2020-jan list(start = "2010-01-01", end = "2020-01-01", id = "t") ) rh <- tramoseats_revisions(s, sa_mod$result_spec, data_ids, ts_ids, cmp_ids)s <- rjd3toolkit::ABS$X0.2.09.10.M sa_mod <- tramoseats(s) data_ids <- list( # Get the coefficient of the trading-day coefficient from 2005-jan list(start = "2005-01-01", id = "regression.td(1)"), # Get the ljung-box statistics on residuals from 2010-jan list(start = "2010-01-01", id = "residuals.lb") ) ts_ids <- list( # Get the SA component estimates of 2010-jan from 2010-jan list(period = "2010-01-01", start = "2010-01-01", id = "sa"), # Get the irregular component estimates of 2010-jan from 2015-jan list(period = "2010-01-01", start = "2015-01-01", id = "i") ) cmp_ids <- list( # Get the SA component estimates (full time series) 2010-jan to 2020-jan list(start = "2010-01-01", end = "2020-01-01", id = "sa"), # Get the trend component estimates (full time series) 2010-jan to 2020-jan list(start = "2010-01-01", end = "2020-01-01", id = "t") ) rh <- tramoseats_revisions(s, sa_mod$result_spec, data_ids, ts_ids, cmp_ids)
Set of functions(tramoseats_spec(),tramo_spec()) to create default specifications associated with the TRAMO-SEATS seasonal adjustment method.
Specification creation can be restricted to the tramo part with the tramo_spec() function.
tramo_spec(name = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5")) tramoseats_spec( name = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5") )tramo_spec(name = c("trfull", "tr0", "tr1", "tr2", "tr3", "tr4", "tr5")) tramoseats_spec( name = c("rsafull", "rsa0", "rsa1", "rsa2", "rsa3", "rsa4", "rsa5") )
name |
the name of a predefined specification. |
Without argument tramo_spec() yields a TR5 specification
without argument tramoseats_spec() yields a RSA5 specification
The available predefined 'JDemetra+' model specifications are described in the table below:
| Identifier | | Log/level detection | | Outliers detection | | Calendar effects | | ARIMA | |||
| RSA0/TR0 | | NA | | NA | | NA | | Airline(+mean) | |||
| RSA1/TR1 | | automatic | | AO/LS/TC | | NA | | Airline(+mean) | |||
| RSA2/TR2 | | automatic | | AO/LS/TC | | 2 td vars + Easter | | Airline(+mean) | |||
| RSA3/TR3 | | automatic | | AO/LS/TC | | NA | | automatic | |||
| RSA4/TR4 | | automatic | | AO/LS/TC | | 2 td vars + Easter | | automatic | |||
| RSA5/TR5 | | automatic | | AO/LS/TC | | 7 td vars + Easter | | automatic | |||
| RSAfull/TRfull | | automatic | | AO/LS/TC | | automatic | | automatic |
an object of class "JD3_TRAMOSEATS_SPEC" (tramoseats_spec()) or
"JD3_TRAMO_SPEC" (tramo_spec()).
To set the pre-processing parameters:
rjd3toolkit::set_arima(), rjd3toolkit::set_automodel(),
rjd3toolkit::set_basic(), rjd3toolkit::set_easter(),
rjd3toolkit::set_estimate(), rjd3toolkit::set_outlier(),
rjd3toolkit::set_tradingdays(), rjd3toolkit::set_transform(),
rjd3toolkit::add_outlier(), rjd3toolkit::remove_outlier(),
rjd3toolkit::add_ramp(), rjd3toolkit::remove_ramp(),
rjd3toolkit::add_usrdefvar();
To set the decomposition parameters: set_seats();
To set the benchmarking parameters: rjd3toolkit::set_benchmarking().
init_spec <- tramoseats_spec() init_spec <- tramo_spec() init_spec <- tramoseats_spec("rsa3") init_spec <- tramo_spec("tr3")init_spec <- tramoseats_spec() init_spec <- tramo_spec() init_spec <- tramoseats_spec("rsa3") init_spec <- tramo_spec("tr3")