View source: R/regarima_specX13.R
regarima_spec_x13 | R Documentation |
Function to create (and/or modify) a c("regarima_spec","X13")
class object with the RegARIMA model specification
for the X13 method. The object can be created from a predefined 'JDemetra+' model specification (a character
),
a previous specification (c("regarima_spec","X13")
object) or a X13 RegARIMA model (c("regarima","X13")
).
regarima_spec_x13(
spec = c("RG5c", "RG0", "RG1", "RG2c", "RG3", "RG4c"),
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_,
transform.function = c(NA, "Auto", "None", "Log"),
transform.adjust = c(NA, "None", "LeapYear", "LengthOfPeriod"),
transform.aicdiff = 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.option = c(NA, "TradingDays", "WorkingDays", "UserDefined", "None"),
tradingdays.autoadjust = NA,
tradingdays.leapyear = c(NA, "LeapYear", "LengthOfPeriod", "None"),
tradingdays.stocktd = NA_integer_,
tradingdays.test = c(NA, "Remove", "Add", "None"),
easter.enabled = NA,
easter.julian = NA,
easter.duration = NA_integer_,
easter.test = c(NA, "Add", "Remove", "None"),
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.method = c(NA, "AddOne", "AddAll"),
outlier.tcrate = NA_integer_,
automdl.enabled = NA,
automdl.acceptdefault = NA,
automdl.cancel = NA_integer_,
automdl.ub1 = NA_integer_,
automdl.ub2 = NA_integer_,
automdl.mixed = NA,
automdl.balanced = NA,
automdl.armalimit = NA_integer_,
automdl.reducecv = NA_integer_,
automdl.ljungboxlimit = NA_integer_,
automdl.ubfinal = NA_integer_,
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_
)
spec |
the model specification. It can be the name ( |
preliminary.check |
a Boolean to check the quality of the input series and exclude highly problematic ones (e.g. the series with a number of identical observations and/or missing values above pre-specified threshold values). 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 character in format "YYYY-MM-DD" indicating the end of the time span (e.g. "2020-12-31").
It can be combined with the parameter |
estimate.first |
a numeric specifying the number of periods considered at the beginning of the series. |
estimate.last |
numeric specifying the number of periods considered at the end of the series. |
estimate.exclFirst |
a numeric specifying the number of periods excluded at the beginning of the series.
It can be combined with the parameter |
estimate.exclLast |
a numeric specifying the number of periods excluded at the end of the series.
It can be combined with the parameter |
estimate.tol |
a numeric, convergence tolerance. The absolute changes in the log-likelihood function are compared to this value to check for the convergence of the estimation iterations. |
transform.function |
the transformation of the input series: |
transform.adjust |
pre-adjustment of the input series for the length of period or leap year effects:
|
transform.aicdiff |
a numeric defining the difference in AICC needed to accept no transformation when the automatic
transformation selection is chosen (considered only when Control variables for the pre-specified outliers. The pre-specified outliers are used in the model only when enabled
( |
usrdef.outliersEnabled |
logical. If |
usrdef.outliersType |
a vector defining the outlier type. Possible types are: |
usrdef.outliersDate |
a vector defining the outlier dates. 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
Control variables for the user-defined variables: |
usrdef.varEnabled |
a logical. If |
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.option |
to specify the set of trading days regression variables:
|
tradingdays.autoadjust |
a logical. If |
tradingdays.leapyear |
a |
tradingdays.stocktd |
a 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 for the significance of the trading day regression variables
based on the AICC statistics: |
easter.enabled |
a logical. If |
easter.julian |
a logical. If |
easter.duration |
a numeric indicating the duration of the Easter effect (length in days, between 1 and 20). |
easter.test |
defines the pre-tests for the significance of the Easter effect based on the t-statistic
(the Easter effect is considered as significant if the t-statistic is greater than 1.96):
|
outlier.enabled |
a logical. If The time span during which outliers will be searched 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 the parameter |
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 the parameter |
outlier.first |
a numeric specifying the number of periods considered at the beginning of the series. |
outlier.last |
a numeric specifying the number of periods considered at the end of the series. |
outlier.exclFirst |
a numeric specifying the number of periods excluded at the beginning of the series.
It can be combined with the parameter |
outlier.exclLast |
a numeric specifying the number of periods excluded at the end of the series.
It can be combined with the parameter |
outlier.ao |
a logical. If |
outlier.tc |
a logical. If |
outlier.ls |
a logical. If |
outlier.so |
a logical. If |
outlier.usedefcv |
a logical. If |
outlier.cv |
a numeric. The entered critical value for the outlier detection procedure.
The modification of this variable is only taken into account when |
outlier.method |
determines how the program successively adds detected outliers to the model.
At present, only the |
outlier.tcrate |
a numeric. The rate of decay for the transitory change outlier. |
automdl.enabled |
a logical. If Control variables for the automatic modelling of the ARIMA model (when |
automdl.acceptdefault |
a logical. If |
automdl.cancel |
the cancellation limit ( |
automdl.ub1 |
the first unit root limit ( |
automdl.ub2 |
the second unit root limit ( |
automdl.mixed |
a logical. This variable controls whether ARIMA models with non-seasonal AR and MA terms
or seasonal AR and MA terms will be considered in the automatic model identification procedure.
If |
automdl.balanced |
a logical. If |
automdl.armalimit |
the ARMA limit ( |
automdl.reducecv |
numeric, ReduceCV. The percentage by which the outlier's critical value will be reduced when an identified model is found to have a Ljung-Box statistic with an unacceptable confidence coefficient. The parameter should be between 0 and 1, and will only be active when automatic outlier identification is enabled. The reduced critical value will be set to (1-ReduceCV)*CV, where CV is the original critical value. |
automdl.ljungboxlimit |
the Ljung Box limit ( |
automdl.ubfinal |
numeric, final unit root limit. The threshold value for the final unit root test. If the magnitude of an AR root for the final model is smaller than the final unit root limit, then a unit root is assumed, the order of the AR polynomial is reduced by one and the appropriate order of the differencing (non-seasonal, seasonal) is increased. The parameter value should be greater than one. Control variables for the non-automatic modelling of the ARIMA model (when |
arima.mu |
logical. If |
arima.p |
numeric. The order of the non-seasonal autoregressive (AR) polynomial. |
arima.d |
numeric. The regular differencing order. |
arima.q |
numeric. The order of the non-seasonal moving average (MA) polynomial. |
arima.bp |
numeric. The order of the seasonal autoregressive (AR) polynomial. |
arima.bd |
numeric. The seasonal differencing order. |
arima.bq |
numeric. The order of the seasonal moving average (MA) polynomial. Control variables for the user-defined ARMA coefficients. 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 |
logical. If |
arima.coef |
a vector providing the coefficients for the regular and seasonal AR and MA polynomials.
The vector length 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 |
a vector defining the ARMA coefficients estimation procedure.
Possible procedures are: |
fcst.horizon |
the forecasting horizon ( |
The available predefined 'JDemetra+' model specifications are described in the table below:
Identifier | | Log/level detection | | Outliers detection | | Calendar effects | | ARIMA |
RG0 | | NA | | NA | | NA | | Airline(+mean) |
RG1 | | automatic | | AO/LS/TC | | NA | | Airline(+mean) |
RG2c | | automatic | | AO/LS/TC | | 2 td vars + Easter | | Airline(+mean) |
RG3 | | automatic | | AO/LS/TC | | NA | | automatic |
RG4c | | automatic | | AO/LS/TC | | 2 td vars + Easter | | automatic |
RG5c | | automatic | | AO/LS/TC | | 7 td vars + Easter | | automatic |
A list of class c("regarima_spec","X13")
with the following components, each referring to a different part
of the RegARIMA model specification, mirroring the arguments of the function (for details, see the arguments description).
Each lowest-level component (except span, pre-specified outliers, user-defined variables and pre-specified ARMA coefficients)
is structured within a data frame with columns denoting different variables of the model specification and rows referring to:
first row = 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 = final model specification, values that will be used in the function regarima
.
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.
estimate |
a data frame. Variables referring to: |
transform |
a data frame. Variables referring to: |
regression |
a list containing the information on the user-defined variables ( |
outliers |
a data frame. Variables referring to: |
arima |
a list of a data frame with the ARIMA settings ( |
forecast |
a data frame with the forecast horizon (argument |
span |
a matrix containing the final time span for the model estimation and outlier detection.
It contains the same information as the variable span in the data frames estimate and outliers.
The matrix can be also accessed with the function |
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
myseries <- ipi_c_eu[, "FR"]
myspec1 <- regarima_spec_x13(spec = "RG5c")
myreg1 <- regarima(myseries, spec = myspec1)
# To modify a pre-specified model specification
myspec2 <- regarima_spec_x13(spec = "RG5c",
tradingdays.option = "WorkingDays")
myreg2 <- regarima(myseries, spec = myspec2)
# To modify the model specification of a "regarima" object
myspec3 <- regarima_spec_x13(myreg1, tradingdays.option = "WorkingDays")
myreg3 <- regarima(myseries, myspec3)
# To modify the model specification of a "regarima_spec" object
myspec4 <- regarima_spec_x13(myspec1, tradingdays.option = "WorkingDays")
myreg4 <- regarima(myseries, myspec4)
# Pre-specified outliers
myspec1 <- regarima_spec_x13(spec = "RG5c", 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")
myreg1 <- regarima(myseries, myspec1)
myreg1
s_preOut(myreg1)
# User-defined variables
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)
myspec1 <- regarima_spec_x13(spec = "RG5c", usrdef.varEnabled = TRUE,
usrdef.var = var)
myreg1 <- regarima(myseries, myspec1)
myreg1
myspec2 <- regarima_spec_x13(spec = "RG5c", usrdef.varEnabled = TRUE,
usrdef.var = var1, usrdef.varCoef = 2,
transform.function = "None")
myreg2 <- regarima(myseries, myspec2)
s_preVar(myreg2)
# Pre-specified ARMA coefficients
myspec1 <- regarima_spec_x13(spec = "RG5c", automdl.enabled =FALSE,
arima.p = 1, arima.q = 1, arima.bp = 0, arima.bq = 1,
arima.coefEnabled = TRUE, arima.coef = c(-0.8, -0.6, 0),
arima.coefType = c(rep("Fixed", 2), "Undefined"))
s_arimaCoef(myspec1)
myreg1 <- regarima(myseries, myspec1)
myreg1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.