View source: R/tramoseats_spec.R
tramoseats_spec | R Documentation |
Function to create (and/or modify) a c("SA_spec", "TRAMO_SEATS")
class object with the SA model specification
for the TRAMO-SEATS method. It can be done from a pre-defined 'JDemetra+' model specification (a character
),
a previous specification (c("SA_spec", "TRAMO_SEATS")
object) or a seasonal adjustment model (c("SA", "TRAMO_SEATS")
object).
tramoseats_spec(
spec = c("RSAfull", "RSA0", "RSA1", "RSA2", "RSA3", "RSA4", "RSA5"),
preliminary.check = NA,
estimate.from = NA_character_,
estimate.to = NA_character_,
estimate.first = NA_integer_,
estimate.last = NA_integer_,
estimate.exclFirst = NA_integer_,
estimate.exclLast = NA_integer_,
estimate.tol = NA_integer_,
estimate.eml = NA,
estimate.urfinal = NA_integer_,
transform.function = c(NA, "Auto", "None", "Log"),
transform.fct = NA_integer_,
usrdef.outliersEnabled = NA,
usrdef.outliersType = NA,
usrdef.outliersDate = NA,
usrdef.outliersCoef = NA,
usrdef.varEnabled = NA,
usrdef.var = NA,
usrdef.varType = NA,
usrdef.varCoef = NA,
tradingdays.mauto = c(NA, "Unused", "FTest", "WaldTest"),
tradingdays.pftd = NA_integer_,
tradingdays.option = c(NA, "TradingDays", "WorkingDays", "UserDefined", "None"),
tradingdays.leapyear = NA,
tradingdays.stocktd = NA_integer_,
tradingdays.test = c(NA, "Separate_T", "Joint_F", "None"),
easter.type = c(NA, "Unused", "Standard", "IncludeEaster", "IncludeEasterMonday"),
easter.julian = NA,
easter.duration = NA_integer_,
easter.test = NA,
outlier.enabled = NA,
outlier.from = NA_character_,
outlier.to = NA_character_,
outlier.first = NA_integer_,
outlier.last = NA_integer_,
outlier.exclFirst = NA_integer_,
outlier.exclLast = NA_integer_,
outlier.ao = NA,
outlier.tc = NA,
outlier.ls = NA,
outlier.so = NA,
outlier.usedefcv = NA,
outlier.cv = NA_integer_,
outlier.eml = NA,
outlier.tcrate = NA_integer_,
automdl.enabled = NA,
automdl.acceptdefault = NA,
automdl.cancel = NA_integer_,
automdl.ub1 = NA_integer_,
automdl.ub2 = NA_integer_,
automdl.armalimit = NA_integer_,
automdl.reducecv = NA_integer_,
automdl.ljungboxlimit = NA_integer_,
automdl.compare = NA,
arima.mu = NA,
arima.p = NA_integer_,
arima.d = NA_integer_,
arima.q = NA_integer_,
arima.bp = NA_integer_,
arima.bd = NA_integer_,
arima.bq = NA_integer_,
arima.coefEnabled = NA,
arima.coef = NA,
arima.coefType = NA,
fcst.horizon = NA_integer_,
seats.predictionLength = NA_integer_,
seats.approx = c(NA, "None", "Legacy", "Noisy"),
seats.trendBoundary = NA_integer_,
seats.seasdBoundary = NA_integer_,
seats.seasdBoundary1 = NA_integer_,
seats.seasTol = NA_integer_,
seats.maBoundary = NA_integer_,
seats.method = c(NA, "Burman", "KalmanSmoother", "McElroyMatrix"),
benchmarking.enabled = NA,
benchmarking.target = c(NA, "Original", "CalendarAdjusted"),
benchmarking.useforecast = NA,
benchmarking.rho = NA_real_,
benchmarking.lambda = NA_real_
)
spec |
a TRAMO-SEATS model specification. It can be the 'JDemetra+' name ( |
preliminary.check |
a The time span of the series, which is the (sub)period used to estimate the regarima model, is controlled by the following six variables:
|
estimate.from |
a character in format "YYYY-MM-DD" indicating the start of the time span (e.g. "1900-01-01").
It can be combined with the parameter |
estimate.to |
a |
estimate.first |
|
estimate.last |
|
estimate.exclFirst |
|
estimate.exclLast |
|
estimate.tol |
|
estimate.eml |
|
estimate.urfinal |
|
transform.function |
the transformation of the input series: |
transform.fct |
Control variables for the pre-specified outliers. Said pre-specified outliers are used in the model only when enabled
( |
usrdef.outliersEnabled |
|
usrdef.outliersType |
a vector defining the outliers' type. Possible types are: |
usrdef.outliersDate |
a vector defining the outliers' date. The dates should be characters in format "YYYY-MM-DD".
E.g.: |
usrdef.outliersCoef |
a vector providing fixed coefficients for the outliers. The coefficients can't be fixed if
the parameter Control variables for the user-defined variables: |
usrdef.varEnabled |
|
usrdef.var |
a time series ( |
usrdef.varType |
a vector of character(s) defining the user-defined variables component type.
Possible types are: |
usrdef.varCoef |
a vector providing fixed coefficients for the user-defined variables. The coefficients can't be fixed if
|
tradingdays.mauto |
defines whether the calendar effects should be added to the model manually ( |
tradingdays.pftd |
Control variables for the manual selection of calendar effects variables ( |
tradingdays.option |
to choose the trading days regression variables: |
tradingdays.leapyear |
|
tradingdays.stocktd |
numeric indicating the day of the month when inventories and other stock are reported (to denote the last day of the month set the variable to 31). Modifications of this variable are taken into account only when |
tradingdays.test |
defines the pre-tests of the trading day effects: |
easter.type |
a |
easter.julian |
|
easter.duration |
|
easter.test |
|
outlier.enabled |
The time span of the series to be searched for outliers is controlled by the following six variables:
|
outlier.from |
a character in format "YYYY-MM-DD" indicating the start of the time span (e.g. "1900-01-01").
It can be combined with |
outlier.to |
a character in format "YYYY-MM-DD" indicating the end of the time span (e.g. "2020-12-31").
It can be combined with |
outlier.first |
|
outlier.last |
|
outlier.exclFirst |
|
outlier.exclLast |
|
outlier.ao |
|
outlier.tc |
|
outlier.ls |
|
outlier.so |
|
outlier.usedefcv |
|
outlier.cv |
|
outlier.eml |
|
outlier.tcrate |
|
automdl.enabled |
Control variables for the automatic modelling of the ARIMA model ( |
automdl.acceptdefault |
|
automdl.cancel |
|
automdl.ub1 |
|
automdl.ub2 |
|
automdl.armalimit |
|
automdl.reducecv |
|
automdl.ljungboxlimit |
|
automdl.compare |
Control variables for the non-automatic modelling of the ARIMA model ( |
arima.mu |
|
arima.p |
|
arima.d |
|
arima.q |
|
arima.bp |
|
arima.bd |
|
arima.bq |
Control variables for the user-defined ARMA coefficients. Such coefficients can be defined for the regular and seasonal autoregressive (AR) polynomials
and moving average (MA) polynomials. The model considers the coefficients only if the procedure for their estimation ( |
arima.coefEnabled |
|
arima.coef |
a vector providing the coefficients for the regular and seasonal AR and MA polynomials.
The length of the vector must be equal to the sum of the regular and seasonal AR and MA orders. The coefficients shall be provided in the following order:
regular AR (Phi - |
arima.coefType |
avector defining the ARMA coefficients estimation procedure. Possible procedures are:
|
fcst.horizon |
|
seats.predictionLength |
integer: the number of forecasts used in the decomposition. Negative values correspond to number of years. Default=-1. |
seats.approx |
character: the approximation mode. When the ARIMA model estimated by TRAMO does not accept an admissible decomposition, SEATS: |
seats.trendBoundary |
numeric: the trend boundary. 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. |
seats.seasdBoundary |
numeric: the seasonal boundary. The boundary beyond which a 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. |
seats.seasdBoundary1 |
numeric: the seasonal boundary (unique). 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. |
seats.seasTol |
numeric: the seasonal tolerance. 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. |
seats.maBoundary |
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. |
seats.method |
character: the estimation method for the unobserved components. The choice can be made from:
|
benchmarking.enabled |
logical: to enable benchmarking. If |
benchmarking.target |
character: the target of the benchmarking procedure, which can be the raw series ( |
benchmarking.useforecast |
logical: If |
benchmarking.rho |
numeric: the value of the AR(1) parameter (set between 0 and 1) in the function used for benchmarking. |
benchmarking.lambda |
numeric: a parameter used for benchmarking that relatesto to the weights in the regression equation. It is typically equal to 0, 1/2 or 1. |
The available predefined 'JDemetra+' 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 |
A two-element list of class c("SA_spec", "TRAMO_SEATS")
, containing:
(1) an object of class c("regarima_spec", "TRAMO_SEATS")
with the RegARIMA model specification,
(2) an object of class c("seats_spec", "data.frame")
with the SEATS algorithm specification.
Each component refers to a different part of the SA model specification, mirroring the arguments of the function
(for details see the function arguments in the description).
Each lowest-level component (except span, pre-specified outliers, user-defined variables and pre-specified ARMA coefficients)
is structured as a data frame with columns denoting different variables of the model specification and rows referring to:
first row: the base specification, as provided within the argument spec
;
second row: user modifications as specified by the remaining arguments of the function (e.g.: arima.d
);
and third row: the final model specification.
The final specification (third row) shall include user modifications (row two) unless they were wrongly specified.
The pre-specified outliers, user-defined variables and pre-specified ARMA coefficients consist of a list of
Predefined
(base model specification) and Final
values.
regarima
: an object of class c("regarima_spec", "TRAMO_SEATS")
. See Value of the function regarima_spec_tramoseats
.
seats
: a data.frame of class c("seats_spec", "data.frame")
, containing the seats variables in line with
the names of the arguments variables. The final values can also be accessed with the function s_seats
.
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
tramoseats
myseries <- ipi_c_eu[, "FR"]
myspec1 <- tramoseats_spec(spec = c("RSAfull"))
mysa1 <- tramoseats(myseries, spec = myspec1)
# To modify a pre-specified model specification
myspec2 <- tramoseats_spec(spec = "RSAfull", tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard",
automdl.enabled = FALSE, arima.mu = TRUE)
mysa2 <- tramoseats(myseries, spec = myspec2)
# To modify the model specification of a "SA" object
myspec3 <- tramoseats_spec(mysa1, tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard", automdl.enabled = FALSE, arima.mu = TRUE)
mysa3 <- tramoseats(myseries, myspec3)
# To modify the model specification of a "SA_spec" object
myspec4 <- tramoseats_spec(myspec1, tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard", automdl.enabled = FALSE, arima.mu = TRUE)
mysa4 <- tramoseats(myseries, myspec4)
# Pre-specified outliers
myspec5 <- tramoseats_spec(spec = "RSAfull",
usrdef.outliersEnabled = TRUE,
usrdef.outliersType = c("LS", "LS"),
usrdef.outliersDate = c("2008-10-01", "2003-01-01"),
usrdef.outliersCoef = c(10,-8), transform.function = "None")
s_preOut(myspec5)
mysa5 <- tramoseats(myseries, myspec5)
mysa5
s_preOut(mysa5)
# User-defined calendar regressors
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)
myspec6 <- tramoseats_spec(spec = "RSAfull", tradingdays.option = "UserDefined",
usrdef.varEnabled = TRUE, usrdef.var = var,
usrdef.varType = c("Calendar", "Calendar"))
s_preVar(myspec6)
mysa6 <- tramoseats(myseries, myspec6)
myspec7 <- tramoseats_spec(spec = "RSAfull", usrdef.varEnabled = TRUE,
usrdef.var = var, usrdef.varCoef = c(17,-1),
transform.function = "None")
mysa7 <- tramoseats(myseries, myspec7)
# Pre-specified ARMA coefficients
myspec8 <- tramoseats_spec(spec = "RSAfull",
arima.coefEnabled = TRUE, automdl.enabled = FALSE,
arima.p = 2, arima.q = 0,
arima.bp = 1, arima.bq = 1,
arima.coef = c(-0.12, -0.12, -0.3, -0.99),
arima.coefType = rep("Fixed", 4))
mysa8 <- tramoseats(myseries, myspec8)
mysa8
s_arimaCoef(myspec8)
s_arimaCoef(mysa8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.