Type: | Package |
Title: | Interface to 'JDemetra+' Seasonal Adjustment Software |
Version: | 0.2.8 |
Description: | Interface around 'JDemetra+' (https://github.com/jdemetra/jdemetra-app), the seasonal adjustment software officially recommended to the members of the European Statistical System (ESS) and the European System of Central Banks. It offers full access to all options and outputs of 'JDemetra+', including the two leading seasonal adjustment methods TRAMO/SEATS+ and X-12ARIMA/X-13ARIMA-SEATS. |
Depends: | R (≥ 3.1.1), |
Imports: | rJava (≥ 0.9-8), graphics, grDevices, methods, stats, utils |
SystemRequirements: | Java (>= 8) |
License: | EUPL version 1.1 | EUPL version 1.2 [expanded from: EUPL] |
LazyData: | TRUE |
Suggests: | knitr, rmarkdown |
URL: | https://rjdverse.github.io/rjdemetra/, https://github.com/rjdverse/rjdemetra |
BugReports: | https://github.com/rjdverse/rjdemetra/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2024-12-12 09:59:45 UTC; alainquartierlatente |
Author: | Alain Quartier-la-Tente
|
Maintainer: | Alain Quartier-la-Tente <alain.quartier@yahoo.fr> |
Repository: | CRAN |
Date/Publication: | 2024-12-12 10:40:01 UTC |
Add a seasonally adjusted series to a multi-processing
Description
Function to add a new seasonally adjusted object (class "SA"
or "jSA"
) to a workspace
object.
Usage
add_sa_item(workspace, multiprocessing, sa_obj, name)
Arguments
workspace |
the workspace to add the seasonally adjusted series to. |
multiprocessing |
the name or index of the multiprocessing to add the seasonally adjusted series to. |
sa_obj |
the seasonally adjusted object to add. |
name |
the name of the seasonally adjusted series in the multiprocessing.
By default the name of the |
See Also
load_workspace
, save_workspace
Examples
dir <- tempdir()
# Adjustment of a series with the x13 and Tramo-Seats methods
spec_x13 <- x13_spec(spec = "RSA5c", easter.enabled = FALSE)
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = spec_x13)
spec_ts <- tramoseats_spec(spec = "RSA5")
sa_ts <- jtramoseats(ipi_c_eu[, "FR"], spec = spec_ts)
# Creation of a new workspace..
wk <- new_workspace()
# and of the multiprocessing "sa1" that will contain the series
new_multiprocessing(wk, "sa1")
# Addition of the adjusted series to the workspace via the sa1 multiprocessing
add_sa_item(wk, "sa1", sa_x13, "X13")
add_sa_item(wk, "sa1", sa_ts, "TramoSeats")
# Export of the new filled workspace
save_workspace(wk, file.path(dir, "workspace.xml"))
Compute a workspace multi-processing(s)
Description
Function to compute all the multiprocessings or only a given one from a workspace.
By default, the workspace only contains definitions: computation is needed to recalculate and access the adjusted model
(with get_model
).
Usage
compute(workspace, i)
Arguments
workspace |
the workspace to compute. |
i |
a |
See Also
Examples
spec_x13 <- x13_spec(spec = "RSA5c", easter.enabled = FALSE)
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = spec_x13)
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
add_sa_item(wk, "sap1", sa_x13, "X13")
sa_item1 <- get_object(mp, 1)
get_model(sa_item1, wk) # Returns NULL
compute(wk)
get_model(sa_item1, wk) # Returns the SA model sa_x13
Count the number of objects inside a workspace or multiprocessing
Description
Generic functions to count the number of multiprocessing
(respectively sa_item
)
inside a workspace
(respectively multiprocessing
).
Usage
count(x)
Arguments
x |
the |
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: get_model
, get_name
, get_ts
.
Examples
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
count(wk) # 1 multiprocessing inside the workspace wk
count(mp) # 0 sa_item inside the multiprocessing mp
Get the Java name of all the contained object
Description
Generic functions to retrieve the Java name of the contained multiprocessings
or the contained sa_items
.
Usage
get_all_names(x)
Arguments
x |
An object containing other objects whose names we want to know |
Value
A character
vector containing all the names.
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: get_name
, get_position
, count
, get_model
, get_ts
.
Examples
spec_x13 <- x13_spec(spec = "RSA5c", easter.enabled = FALSE)
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = spec_x13)
spec_ts <- tramoseats_spec(spec = "RSA5")
sa_ts <- tramoseats(ipi_c_eu[, "FR"], spec = spec_ts)
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
mp2 <- new_multiprocessing(wk, "sap2")
get_all_names(wk)
add_sa_item(wk, "sap1", sa_x13, "X13")
add_sa_item(wk, "sap1", sa_ts, "TramoSeats")
get_all_names(mp)
Get the seasonally adjusted model from a workspace
Description
Generic functions to retrieve seasonally adjusted model(s) from workspace
,
multiprocessing
or sa_item
object. get_model
returns a "SA"
object while get_jmodel
returns the Java objects of the models.
Usage
get_jmodel(
x,
workspace,
userdefined = NULL,
progress_bar = TRUE,
type = c("Domain", "Estimation", "Point")
)
get_model(
x,
workspace,
userdefined = NULL,
progress_bar = TRUE,
type = c("Domain", "Estimation", "Point")
)
Arguments
x |
the object from which to retrieve the seasonally adjusted model. |
workspace |
the workspace object where models are stored. If |
userdefined |
a vector containing the names of additional output variables.
(see |
progress_bar |
Boolean: if |
type |
a |
Value
get_model()
returns a seasonally adjusted object (class c("SA", "X13")
or c("SA", "TRAMO_SEATS"
) or a list of seasonally adjusted objects:
if
x
is asa_item
object,get_model(x)
returns a"SA"
object (or ajSA
object withget_jmodel(x)
);if
x
is amultiprocessing
object,get_ts(x)
returns a list of length the number of sa_items, each element containing a"SA"
object (or ajSA
object withget_jmodel(x)
);if
x
is aworkspace
object,get_ts(x)
returns list of length the number of multiprocessings, each element containing a list of"SA"
object(s) (orjSA
object's) withget_jmodel(x)
).
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: count
, get_name
, get_ts
.
Examples
spec_x13 <- x13_spec(spec = "RSA5c", easter.enabled = FALSE)
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = spec_x13)
spec_ts <- tramoseats_spec(spec = "RSA5")
sa_ts <- tramoseats(ipi_c_eu[, "FR"], spec = spec_ts)
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
add_sa_item(wk, "sap1", sa_x13, "X13")
add_sa_item(wk, "sap1", sa_ts, "TramoSeats")
compute(wk) # It's important to compute the workspace before retrieving the SA model
sa_item1 <- get_object(mp, 1)
get_model(sa_item1, wk) # To extract the model of the sa_item1: its the object sa_x13
# To get all models from the multiprocessing mp:
get_model(mp, wk)
# To get all models from the workspace wk:
get_model(wk)
Get the Java name of a multiprocessing or a sa_item
Description
Generic functions to retrieve the Java name of a multiprocessing
or a sa_item
.
Usage
get_name(x)
Arguments
x |
the object to retrieve the name from. |
Value
A character
.
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: count
, get_model
, get_ts
.
Examples
spec_x13 <- x13_spec(spec = "RSA5c", easter.enabled = FALSE)
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = spec_x13)
spec_ts <- tramoseats_spec(spec = "RSA5")
sa_ts <- tramoseats(ipi_c_eu[, "FR"], spec = spec_ts)
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
add_sa_item(wk, "sap1", sa_x13, "X13")
add_sa_item(wk, "sap1", sa_ts, "TramoSeats")
sa_item1 <- get_object(mp, 1)
sa_item2 <- get_object(mp, 2)
get_name(sa_item1) # returns "X13"
get_name(sa_item2) # returns "TramoSeats"
get_name(mp) # returns "sap1"
# To retrieve the name of every sa_item in a given multiprocessing:
sapply(get_all_objects(mp), get_name)
# To retrieve the name of every multiprocessing in a given workspace:
sapply(get_all_objects(wk), get_name)
# To retrieve the name of every sa_item in a given workspace:
lapply(get_all_objects(wk),function(mp){
sapply(get_all_objects(mp), get_name)
})
Get objects inside a workspace or multiprocessing
Description
Generic functions to retrieve all (get_all_objects()
) multiprocessing
(respectively sa_item
)
from a workspace
(respectively multiprocessing
) or to retrieve a single one (get_object()
) .
Usage
get_object(x, pos = 1)
get_all_objects(x)
Arguments
x |
the object in which to store the extracted |
pos |
the index of the object to extract. |
Value
An object of class multiprocessing
or sa_item
(for get_object()
) or a list
of objects of class multiprocessing
or sa_item
(for get_all_objects()
).
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: count
, get_model
, get_name
, get_ts
.
Examples
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = "RSA5c")
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
add_sa_item(wk, "sap1", sa_x13, "X13")
# A way to retrieve the multiprocessing:
mp <- get_object(wk, 1)
# And the sa_item object:
sa_item <- get_object(mp, 1)
Get the position of an object
Description
Generic functions to retrieve the position of the contained multiprocessings
or the contained sa_items
.
Usage
get_position(x, name)
Arguments
x |
An object containing other objects whose names we want to know |
name |
a |
Value
A integer
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: get_name
, get_all_names
, count
, get_model
, get_ts
.
Examples
spec_x13 <- x13_spec(spec = "RSA5c", easter.enabled = FALSE)
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = spec_x13)
spec_ts <- tramoseats_spec(spec = "RSA5")
sa_ts <- tramoseats(ipi_c_eu[, "FR"], spec = spec_ts)
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
mp2 <- new_multiprocessing(wk, "sap2")
get_position(wk, "sap1")
get_position(wk, "sap2")
add_sa_item(wk, "sap1", sa_x13, "X13")
add_sa_item(wk, "sap1", sa_ts, "TramoSeats")
get_position(mp, "TramoSeats")
get_position(mp, "X13")
Get the input raw time series
Description
Generic functions to retrieve the input raw time series of a workspace
, multiprocessing
,
sa_item
or SA
object.
Usage
get_ts(x)
Arguments
x |
the object from which to retrieve the time series. |
Value
get_ts()
returns a ts
object or list of ts
objects:
if
x
is asa_item
or aSA
object,get_ts(x)
returns a singlets
object;if
x
is amultiprocessing
object,get_ts(x)
returns a list of length the number of sa_items, each element being ats
object;if
x
is aworkspace
object,get_ts(x)
returns a list of length the number of multiprocessings, each element being a list ofts
objects.
See Also
Other functions to retrieve information from a workspace, multiprocessing or sa_item: count
, get_model
, get_name
.
Examples
sa_x13 <- x13(ipi_c_eu[, "FR"], spec = "RSA5c")
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sap1")
add_sa_item(wk, "sap1", sa_x13, "X13")
sa_item <- get_object(mp, 1)
# Extracting the raw time series from an adjusted series:
get_ts(sa_x13) # Returns the ts object ipi_c_eu[, "FR"]
# Extracting the raw time series from a sa_item:
get_ts(sa_item) # Returns the ts object ipi_c_eu[, "FR"]
# Extracting all raw time series from a multiprocessing:
# Returns a list of length 1 named "X13" containing the ts object ipi_c_eu[, "FR"]:
get_ts(mp)
# Extracting all raw time series from a workspace:
# Returns a list of length 1 named "sap1" containing a list
# of length 1 named "X13", containing the ts object ipi_c_eu[, "FR"]
get_ts(wk)
Industrial Production Indices in manufacturing industry in the European Union
Description
A dataset containing on monthly industrial production indices in manufacturing in the European Union (from sts_inpr_m dataset of Eurostat). Data are based 100 in 2015 and are unadjusted, i.e. neither seasonally adjusted nor calendar adjusted.
Usage
ipi_c_eu
Format
A monthly ts
object from January 1990 to December 2020 with 34 variables.
Details
The dataset contains 34 time series corresponding to the following geographical area
BE | Belgium |
BG | Bulgaria |
CZ | Czech Republic |
DK | Denmark |
DE | Germany (until 1990 former territory of the FRG) |
EE | Estonia |
IE | Ireland |
EL | Greece |
ES | Spain |
FR | France |
HR | Croatia |
IT | Italy |
CY | Cyprus |
LV | Latvia |
LT | Lithuania |
LU | Luxembourg |
HU | Hungary |
MT | Malta |
NL | Netherlands |
AT | Austria |
PL | Poland |
PT | Portugal |
RO | Romania |
SI | Slovenia |
SK | Slovakia |
FI | Finland |
SE | Sweden |
UK | United Kingdom |
NO | Norway |
CH | Switzerland |
ME | Montenegro |
MK | Former Yugoslav Republic of Macedonia, the |
RS | Serbia |
TR | Turkey |
BA | Bosnia and Herzegovina |
Source
Eurostat, 'sts_inpr_m' database.
Functions around 'jSA' objects
Description
get_dictionary
returns the indicators that can be extracted from "jSA"
objects,
get_indicators
extracts a list of indicators
jSA2R
returns the corresponding "SA"
.
Usage
get_jspec(x, ...)
get_dictionary(x)
get_indicators(x, ...)
jSA2R(x, userdefined = NULL)
Arguments
x |
a |
... |
characters containing the names of the indicators to extract. |
userdefined |
a userdefined vector containing the names of additional output variables (see |
Details
A "jSA"
object is a list of three elements:
-
"result"
: the Java object containing the results of a seasonal adjustment or a pre-adjustment method. -
"spec"
: the Java object containing the specification of a seasonal adjustment or a pre-adjustment method. -
"dictionary"
: the Java object containing the dictionary of a seasonal adjustment or a pre-adjustment method. In particular, it contains all the user-defined regressors.
get_dictionary
returns the list of indicators that can be extracted from a jSA
object by the function get_indicators
.
jSA2R
returns the corresponding formatted seasonally adjusted ("SA"
object) or RegARIMA ("regarima"
object) model.
get_jspec
returns the Java object that contains the specification of an object. Such object can be of type
"jSA"
, "X13"
, "TRAMO_SEATS"
or "sa_item"
.
Value
get_dictionary
returns a vector of characters,
get_indicators
returns a list containing the indicators that are extracted,
jSA2R
returns a "SA"
or a "regarima"
object and
get_jspec
returns a Java object.
Examples
myseries <- ipi_c_eu[, "FR"]
mysa <- jx13(myseries, spec = "RSA5c")
get_dictionary(mysa)
get_indicators(mysa, "decomposition.b2", "decomposition.d10")
# To convert the Java object to an R object
jSA2R(mysa)
Load a 'JDemetra+' workspace
Description
Function to load a 'JDemetra+' workspace.
Usage
load_workspace(file)
Arguments
file |
the path to the 'JDemetra+' workspace to load. By default a dialog box opens. |
Value
An object of class "workspace"
.
See Also
Create a workspace or a multi-processing
Description
Functions to create a 'JDemetra+' workspace (new_workspace()
) and
to add a new multi-processing (new_multiprocessing()
).
Usage
new_workspace()
new_multiprocessing(workspace, name)
Arguments
workspace |
a workspace object |
name |
character name of the new multiprocessing |
Value
new_workspace()
returns an object of class workspace
and
new_multiprocessing()
returns an object of class multiprocessing
.
See Also
load_workspace
, save_workspace
,
add_sa_item
Examples
# To create and export an empty 'JDemetra+' workspace
wk <- new_workspace()
mp <- new_multiprocessing(wk, "sa1")
Plotting regarima, decomposition or final results of a SA
Description
Plotting methods for the S3 class objects around the seasonal adjustment:
"regarima"
for RegARIMA,"decomposition_X11"
and "decomposition_SEATS"
for
the decomposition with X13 and TRAMO-SEATS, "final"
for the final SA results
and "SA"
for the entire seasonal adjustment object.
The function plot.SA
just calls the function plot.final
.
Usage
## S3 method for class 'regarima'
plot(
x,
which = 1:6,
caption = list("Residuals", "Histogram of residuals", "Normal Q-Q", "ACF of residuals",
"PACF of residuals", "Decomposition", list("Y linearised", "Calendar effects",
"Outliers effects"))[sort(which)],
ask = prod(par("mfcol")) < length(which) && dev.interactive(),
...
)
## S3 method for class 'decomposition_X11'
plot(x, first_date, last_date, caption = "S-I ratio", ylim, ...)
## S3 method for class 'decomposition_SEATS'
plot(x, first_date, last_date, caption = "S-I ratio", ylim, ...)
## S3 method for class 'final'
plot(
x,
first_date,
last_date,
forecast = TRUE,
type_chart = c("sa-trend", "cal-seas-irr"),
caption = c(`sa-trend` = "Y, Sa, trend", `cal-seas-irr` =
"Cal., sea., irr.")[type_chart],
ask = length(type_chart) > 1 && dev.interactive(),
ylim,
...
)
## S3 method for class 'SA'
plot(x, ...)
Arguments
x |
the object to plot |
which |
a numeric vector specifying which graphs should be plotted: (1) "Residuals", (2) "Histogram of residuals", (3) "Normal Q-Q", (4) "ACF of residuals", (5) "PACF of residuals", (6) "Decomposition", (7) "Decomposition - zoom" |
caption |
a string containing the graph title |
ask |
a Boolean. If |
... |
other parameters |
first_date |
the plot starting date. If missing, the plot starts at the beginning of the time-series. |
last_date |
the end date of the plot. If missing, the plot ends at the end of the time-series (eventually, including forecast). |
ylim |
the y limits of the plot. |
forecast |
a Boolean indicating if forecasts should be included in the plot. If |
type_chart |
a string indicating which type of chart to plot |
Examples
myseries <- ipi_c_eu[, "FR"]
mysa <- x13(myseries, spec = c("RSA5c"))
# RegArima
plot(mysa$regarima) # 6 graphics are plotted by default
# To plot only one graphic (here, the residuals) and change the title:
plot(mysa$regarima, which = 1, caption = "Plot of residuals")
plot(mysa$regarima, which = 7)
# Decomposition
plot(mysa$decomposition) # To plot the S-I ratio
plot(mysa$decomposition, first_date = c(2010, 1)) # To start the plot in January 2010
# Final
plot(mysa$final) # 2 graphics are plotted by default
# To only plot one graphic (here the raw data, the seasonally adjusted data and the trend),
# To change the last date and the title
plot(mysa$final, last_date = c(2000, 1),
caption = "Results", type_chart = "sa-trend")
RegARIMA model, pre-adjustment in X13 and TRAMO-SEATS
Description
The regarima/regarima_x13/regarima_tramoseats
functions remove deterministic effects from the input series (e.g.calendar effects, outliers)
using a multivariate regression model with arima errors.
The jregarima/jregarima_x13/jregarima_tramoseats
functions do the same computation but return the Java objects instead of
a formatted output.
Usage
jregarima(series, spec = NA)
jregarima_tramoseats(
series,
spec = c("TRfull", "TR0", "TR1", "TR2", "TR3", "TR4", "TR5")
)
jregarima_x13(series, spec = c("RG5c", "RG0", "RG1", "RG2c", "RG3", "RG4c"))
regarima(series, spec = NA)
regarima_tramoseats(
series,
spec = c("TRfull", "TR0", "TR1", "TR2", "TR3", "TR4", "TR5")
)
regarima_x13(series, spec = c("RG5c", "RG0", "RG1", "RG2c", "RG3", "RG4c"))
Arguments
series |
an univariate time series |
spec |
the model specification. For the function:
|
Details
When seasonally adjusting with X13 and TRAMO-SEATS, the first step consists in pre-adjusting the original series with a RegARIMA model, where the original series is corrected for any deterministic effects and missing observations. This step is also referred to as the linearization of the original series.
The RegARIMA model (model with ARIMA errors) is specified as such:
z_t = y_t\beta + x_t
where:
-
z_t
is the original series; -
\beta = (\beta_1,...,\beta_n)
is a vector of regression coefficients; -
y_t = (y_{1t},...,y_{nt})
aren
regression variables (outliers, calendar effects, user-defined variables); -
x_t
is a disturbance that follows the general ARIMA process:\phi(B)\delta(B)x_t = \theta(B)a_t
; where\phi(B), \delta(B)
and\theta(B)
are finite polynomials inB
anda_t
is a white noise variable with zero mean and a constant variance.
The polynomial \phi(B)
is a stationary autoregressive (AR) polynomial in B
,
which is a product of the stationary regular AR polynomial in B
and the stationary seasonal polynomial
in B^s
:
\phi(B)=\phi_p(B)\Phi_{bp}(B^s)=(1+\phi_1B+...+\phi_pB^p)(1+\Phi_1B^s+...+\Phi_{bp}B^{bps})
where:
-
p
is the number of regular AR terms (here and in 'JDemetra+',p \le 3
); -
bp
is the number of seasonal AR terms (here and in 'JDemetra+',bp \le 1
); -
s
is the number of observations per year (ie. The time series frequency).
The polynomial \theta(B)
is an invertible moving average (MA) polynomial in B
,
which is a product of the invertible regular MA polynomial in B
and the invertible seasonal MA polynomial in B^s
:
\theta(B)=\theta_q(B)\Theta_{bq}(B^s)=(1+\theta_1B+...+\theta_qB^q)(1+\Theta_1B^s+...+\Theta_{bq}B^{bqs})
where:
-
q
is the number of regular MA terms (here and in 'JDemetra+',q \le 3
); -
bq
is the number of seasonal MA terms (here and in 'JDemetra+',bq \le 1
).
The polynomial \delta(B)
is the non-stationary AR polynomial in B
(unit roots):
\delta(B) = (1-B)^d(1-B^s)^{d_s}
where:
-
d
is the regular differencing order (here and in 'JDemetra+',d \le 1
); -
d_s
is the seasonal differencing order (here and in 'JDemetra+',d_s \le 1
).
NB. The notations used for AR and MA processes, as well as the model denoted as ARIMA (P,D,Q)(BP,BD,BQ)
,
are consistent with those in 'JDemetra+'.
The available predefined 'JDemetra+' X13 and TRAMO-SEATS model specifications are described in the tables below:
X13:
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 |
TRAMO-SEATS:
Identifier | | Log/level detection | | Outliers detection | | Calendar effects | | ARIMA |
TR0 | | NA | | NA | | NA | | Airline(+mean) |
TR1 | | automatic | | AO/LS/TC | | NA | | Airline(+mean) |
TR2 | | automatic | | AO/LS/TC | | 2 td vars + Easter | | Airline(+mean) |
TR3 | | automatic | | AO/LS/TC | | NA | | automatic |
TR4 | | automatic | | AO/LS/TC | | 2 td vars + Easter | | automatic |
TR5 | | automatic | | AO/LS/TC | | 7 td vars + Easter | | automatic |
TRfull | | automatic | | AO/LS/TC | | automatic | | automatic |
Value
The jregarima/jregarima_x13/jregarima_tramoseats
functions return a jSA
object
that contains the result of the pre-adjustment method without any formatting. Therefore, the computation
is faster than with the regarima/regarima_x13/regarima_tramoseats
functions.
The results of the seasonal adjustment can be extracted with the function get_indicators
.
The regarima/regarima_x13/regarima_tramoseats
functions return an object of class "regarima"
and sub-class "X13"
or "TRAMO_SEATS"
.
regarima_x13
returns an object of class c("regarima","X13")
and regarima_tramoseats
,
an object of class c("regarima","TRAMO_SEATS")
.
For the function regarima
, the sub-class of the object depends on the used method that is defined by
the spec
object class.
An object of class "regarima"
is a list containing the following components:
specification |
a list with the model specification as defined by the |
arma |
a vector containing the orders of the autoregressive (AR), moving average (MA), seasonal AR and seasonal MA processes, as well as the regular and seasonal differencing orders (P,D,Q) (BP,BD,BQ). |
arima.coefficients |
a matrix containing the estimated regular and seasonal AR and MA coefficients, as well as
the associated standard errors and t-statistics values. The estimated coefficients can be also extracted
with the function |
regression.coefficients |
a matrix containing the estimated regression variables (i.e.: mean, calendar effect, outliers
and user-defined regressors) coefficients, as well as the associated standard errors and t-statistics values.
The estimated coefficients can be also extracted with the function |
loglik |
a matrix containing the log-likelihood of the RegARIMA model as well as the associated model selection criteria statistics
(AIC, AICC, BIC and BICC) and parameters ( |
model |
a list containing information on the model specification after its estimation ( |
residuals |
the residuals (time series). They can be also extracted with the function |
residuals.stat |
a list containing statistics on the RegARIMA residuals. It provides the residuals standard error ( |
forecast |
a ts matrix containing the forecast of the original series ( |
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.
Examples
# X13 method
myseries <- ipi_c_eu[, "FR"]
myreg <- regarima_x13(myseries, spec ="RG5c")
summary(myreg)
plot(myreg)
myspec1 <- regarima_spec_x13(myreg, tradingdays.option = "WorkingDays")
myreg1 <- regarima(myseries, myspec1)
myspec2 <- regarima_spec_x13(myreg, 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")
myreg2 <- regarima(myseries, myspec2)
myreg2
myspec3 <- regarima_spec_x13(myreg, 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(myspec3)
myreg3 <- regarima(myseries, myspec3)
summary(myreg3)
plot(myreg3)
# TRAMO-SEATS method
myspec <- regarima_spec_tramoseats("TRfull")
myreg <- regarima(myseries, myspec)
myreg
myspec2 <- regarima_spec_tramoseats(myspec, tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard",
automdl.enabled = FALSE, arima.mu = TRUE)
myreg2 <- regarima(myseries, myspec2)
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)
myspec3 <- regarima_spec_tramoseats(myspec,
usrdef.varEnabled = TRUE, usrdef.var = var)
s_preVar(myspec3)
myreg3 <- regarima(myseries, myspec3)
myreg3
RegARIMA model specification, pre-adjustment in TRAMO-SEATS
Description
Function to create (and/or modify) a c("regarima_spec","TRAMO_SEATS")
class object with the RegARIMA model specification
for the TRAMO-SEATS method. The object can be created from the name (character
) of a predefined 'JDemetra+' model specification,
a previous specification (c("regarima_spec","TRAMO_SEATS")
object) or a TRAMO-SEATS RegARIMA model (c("regarima","TRAMO_SEATS")
).
Usage
regarima_spec_tramoseats(
spec = c("TRfull", "TR0", "TR1", "TR2", "TR3", "TR4", "TR5"),
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_
)
Arguments
spec |
the model specification. It can be the 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 |
|
Details
The available predefined 'JDemetra+' model specifications are described in the table below:
Identifier | | Log/level detection | | Outliers detection | | Calendar effects | | ARIMA |
TR0 | | NA | | NA | | NA | | Airline(+mean) |
TR1 | | automatic | | AO/LS/TC | | NA | | Airline(+mean) |
TR2 | | automatic | | AO/LS/TC | | 2 td vars + Easter | | Airline(+mean) |
TR3 | | automatic | | AO/LS/TC | | NA | | automatic |
TR4 | | automatic | | AO/LS/TC | | 2 td vars + Easter | | automatic |
TR5 | | automatic | | AO/LS/TC | | 7 td vars + Easter | | automatic |
TRfull | | automatic | | AO/LS/TC | | automatic | | automatic |
Value
A list of class c("regarima_spec","TRAMO_SEATS")
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 the 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 = 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, 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
with the Predefined
(base model specification) and Final
values.
estimate |
a data frame containing Variables referring to: |
transform |
a data frame containing variables referring to: |
regression |
a list containing information on the user-defined variables ( The |
outliers |
a data frame. Variables referring to:
|
arima |
a list containing a data frame with the ARIMA settings ( |
forecast |
a data frame with the forecasting horizon (argument |
span |
a matrix containing the final time span for the model estimation and outliers' 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 |
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
Examples
myseries <- ipi_c_eu[, "FR"]
myspec1 <- regarima_spec_tramoseats(spec = "TRfull")
myreg1 <- regarima(myseries, spec = myspec1)
# To modify a pre-specified model specification
myspec2 <- regarima_spec_tramoseats(spec = "TRfull",
tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard",
automdl.enabled = FALSE, arima.mu = TRUE)
myreg2 <- regarima(myseries, spec = myspec2)
# To modify the model specification of a "regarima" object
myspec3 <- regarima_spec_tramoseats(myreg1,
tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard", automdl.enabled = FALSE,
arima.mu = TRUE)
myreg3 <- regarima(myseries, myspec3)
# To modify the model specification of a "regarima_spec" object
myspec4 <- regarima_spec_tramoseats(myspec1,
tradingdays.mauto = "Unused",
tradingdays.option = "WorkingDays",
easter.type = "Standard",
automdl.enabled = FALSE, arima.mu = TRUE)
myreg4 <- regarima(myseries, myspec4)
# Pre-specified outliers
myspec1 <- regarima_spec_tramoseats(spec = "TRfull",
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(myspec1)
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_tramoseats(spec = "TRfull",
usrdef.varEnabled = TRUE, usrdef.var = var)
s_preVar(myspec1)
myreg1 <- regarima(myseries,myspec1)
myspec2 <- regarima_spec_tramoseats(spec = "TRfull",
usrdef.varEnabled = TRUE,
usrdef.var = var, usrdef.varCoef = c(17,-1),
transform.function = "None")
myreg2 <- regarima(myseries, myspec2)
# Pre-specified ARMA coefficients
myspec1 <- regarima_spec_tramoseats(spec = "TRfull",
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))
myreg1 <- regarima(myseries, myspec1)
myreg1
summary(myreg1)
s_arimaCoef(myspec1)
s_arimaCoef(myreg1)
RegARIMA model specification: the pre-adjustment in X13
Description
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")
).
Usage
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_
)
Arguments
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 ( |
Details
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 |
Value
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 |
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
Examples
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
Saving and loading a model specification, SA and pre-adjustment in X13 and TRAMO-SEATS
Description
save_spec
saves a SA or RegARIMA model specification.
load_spec
loads the previously saved model specification.
Usage
save_spec(object, file = file.path(tempdir(), "spec.RData"))
load_spec(file = "spec.RData")
Arguments
object |
an object of one of the following classes: |
file |
the (path and) name of the file where the model specification will be/has been saved. |
Details
save_spec
saves the final model specification of a "SA_spec"
, "SA"
,
"regarima_spec"
or "regarima"
class object.
load_spec
loads the previously saved model specification. It creates a c("SA_spec","X13")
,
c("sA_spec","TRAMO_SEATS")
, c("regarima_spec","X13")
or c("regarima_spec","TRAMO_SEATS")
class object, in line with the class of the previously saved model specification.
Value
load_spec
returns an object of class "SA_spec"
or "regarima_spec"
.
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
Examples
myseries <- ipi_c_eu[, "FR"]
myreg1 <- regarima_x13(myseries, spec = "RG5c")
myspec2 <- regarima_spec_x13(myreg1, estimate.from = "2005-10-01", outlier.from = "2010-03-01")
myreg2 <- regarima(myseries, myspec2)
myreg3 <- regarima_tramoseats(myseries, spec = "TRfull")
myspec4 <-regarima_spec_tramoseats(myreg3, tradingdays.mauto = "Unused",
tradingdays.option ="WorkingDays",
easter.type = "Standard",
automdl.enabled = FALSE, arima.mu = TRUE)
myreg4 <-regarima(myseries, myspec4)
myspec6 <- x13_spec("RSA5c")
mysa6 <- x13(myseries, myspec6)
myspec7 <- tramoseats_spec("RSAfull")
mysa7 <- tramoseats(myseries, myspec7)
dir <- tempdir()
# To save the model specification of a c("regarima_spec","X13") class object
save_spec(myspec2, file.path(dir, "specx13.RData"))
# To save the model specification of a c("regarima","X13") class object
save_spec(myreg2, file.path(dir,"regx13.RData"))
# To save the model specification of a c("regarima_spec","TRAMO_SEATS") class object
save_spec(myspec4, file.path(dir,"specTS.RData"))
# To save the model specification of a c("regarima","TRAMO_SEATS") class object
save_spec(myreg4, file.path(dir,"regTS.RData"))
# To save the model of a c("SA_spec","X13") class object
save_spec(myspec6, file.path(dir,"specFullx13.RData"))
# To save the model of a c("SA","X13") class object
save_spec(mysa6, file.path(dir,"sax13.RData"))
# To save the model of a c("SA_spec","TRAMO_SEATS") class object
save_spec(myspec7, file.path(dir,"specFullTS.RData"))
# To save the model of a c("SA","TRAMO_SEATS") class object
save_spec(mysa7, file.path(dir,"saTS.RData"))
# To load a model specification:
myspec2a <- load_spec(file.path(dir,"specx13.RData"))
myspec2b <- load_spec(file.path(dir,"regx13.RData"))
myspec4a <- load_spec(file.path(dir,"specTS.RData"))
myspec4b <- load_spec(file.path(dir,"regTS.RData"))
myspec6a <- load_spec(file.path(dir,"specFullx13.RData"))
myspec6b <- load_spec(file.path(dir,"sax13.RData"))
myspec7a <- load_spec(file.path(dir,"specFullTS.RData"))
myspec7b <- load_spec(file.path(dir,"saTS.RData"))
# To use the re-loaded specifications and models:
regarima(myseries, myspec2a)
x13(myseries, myspec6a)
tramoseats(myseries, myspec7a)
regarima(myseries, myspec4a)
x13(myseries, myspec6b)
tramoseats(myseries, myspec7b)
Save a workspace
Description
Function to save a workspace
object into a 'JDemetra+' workspace.
Usage
save_workspace(workspace, file)
Arguments
workspace |
the workspace object to export |
file |
the path where to export the 'JDemetra+' workspace (.xml file). By default, if not specified, a dialog box opens. |
Value
A boolean indicating whether the export is successful.
See Also
Examples
dir <- tempdir()
# Creation and export of an empty 'JDemetra+' workspace
wk <- new_workspace()
new_multiprocessing(wk, "sa1")
save_workspace(wk, file.path(dir, "workspace.xml"))
Access a model specification, a SA or a pre-adjustment model in X13 and TRAMO-SEATS
Description
The following functions enable the access to different parts of the final model specification,
as included in the "SA", "regarima", "SA_spec"
and "regarima_spec"
S3 class objects.
Usage
s_estimate(object = NA)
s_transform(object = NA)
s_usrdef(object = NA)
s_preOut(object = NA)
s_preVar(object = NA)
s_td(object = NA)
s_easter(object = NA)
s_out(object = NA)
s_arima(object = NA)
s_arimaCoef(object = NA)
s_fcst(object = NA)
s_span(object = NA)
s_x11(object = NA)
s_benchmarking(object = NA)
s_seats(object = NA)
Arguments
object |
an object of one of the following classes: |
Value
-
s_estimate
returns a data.frame with the estimate variables -
s_transform
returns a data.frame with the transform variables -
s_usrdef
returns a data.frame with the user-defined regressors (outliers and variables) model specification, indicating if those variables are included in the model and if coefficients are pre-specified -
s_preOut
returns a data.frame with the pre-specified outliers -
s_preVar
returns a list with information on the user-defined variables, including:series
- the time series anddescription
- data.frame with the variable type and coefficients -
s_td
returns a data.frame with the trading.days variables -
s_easter
returns a data.frame with the easter variable -
s_out
returns a data.frame with the outliers detection variables -
s_arima
returns a data.frame with the arima variables -
s_arimaCoef
returns a data.frame with the user-specified ARMA coefficients -
s_fcst
returns a data.frame with the forecast horizon -
s_span
returns a data.frame with the span variables -
s_x11
returns a data.frame with the x11 variables -
s_seats
returns a data.frame with the seats variables
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
Examples
myseries <- ipi_c_eu[, "FR"]
myreg1 <- regarima_x13(myseries, spec = "RG5c")
myspec1 <- regarima_spec_x13(myreg1,
estimate.from = "2005-10-01",
outlier.from = "2010-03-01")
s_estimate(myreg1)
s_estimate(myspec1)
s_transform(myreg1)
s_transform(myspec1)
s_usrdef(myreg1)
s_usrdef(myspec1)
myspec2 <- regarima_spec_x13(myreg1, usrdef.outliersEnabled = TRUE,
usrdef.outliersType = c("LS", "AO"),
usrdef.outliersDate = c("2009-10-01", "2005-02-01"))
myreg2 <- regarima(myseries, myspec2)
s_preOut(myreg2)
s_preOut(myspec2)
var1 <- ts(rnorm(length(myseries))*10, start = start(myseries), frequency = 12)
var2 <- ts(rnorm(length(myseries))*100, start = start(myseries), frequency = 12)
var3 <- ts.union(var1, var2)
myspec3 <- regarima_spec_x13(spec = "RG5c",
usrdef.varEnabled = TRUE,
usrdef.var = var3)
myreg3 <- regarima(myseries, myspec3)
s_preVar(myspec3)
s_preVar(myreg3)
s_td(myreg1)
s_td(myspec1)
s_easter(myreg1)
s_easter(myspec1)
s_out(myreg1)
s_out(myspec1)
s_arima(myreg1)
s_arima(myspec1)
myspec4 <- regarima_spec_x13(myreg1, automdl.enabled = FALSE,
arima.coefEnabled = TRUE,
arima.p = 1,arima.q = 1, arima.bp = 1, arima.bq = 1,
arima.coef = rep(0.2, 4),
arima.coefType = rep("Initial", 4))
myreg4 <- regarima(myseries, myspec4)
s_arimaCoef(myreg4)
s_arimaCoef(myspec4)
s_fcst(myreg1)
s_fcst(myspec1)
s_span(myreg1)
s_span(myspec1)
myspec5 <- x13_spec(spec = "RSA5c", x11.seasonalComp = FALSE)
mysa5 <- x13(myseries, myspec5)
s_x11(mysa5)
s_x11(myspec5)
myspec6 <- tramoseats_spec(spec = "RSAfull", seats.approx = "Noisy")
mysa6 <- tramoseats(myseries, myspec6)
s_seats(mysa6)
s_seats(mysa6)
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 ( |
userdefined |
a |
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 |
decomposition |
an object of class
|
final |
an object of class |
diagnostics |
an object of class
|
user_defined |
an object of class |
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
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)
TRAMO-SEATS model specification
Description
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).
Usage
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_
)
Arguments
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. |
Details
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 |
Value
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) andFinal
values.-
regarima
: an object of classc("regarima_spec", "TRAMO_SEATS")
. See Value of the functionregarima_spec_tramoseats
. -
seats
: a data.frame of classc("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 functions_seats
.
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
See Also
Examples
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)
Display a list of all the available output objects (series, parameters, diagnostics)
Description
Function generating a comprehensive list of available output variables (series, parameters, diagnostics) from the estimation process
with x13
and tramoseats
.
Some items are available in the default estimation output but the remainder can be added
using the userdefined
parameter.
Usage
user_defined_variables(sa_object = c("X13-ARIMA", "TRAMO-SEATS"))
Arguments
sa_object |
a character: |
Value
a vector containing the names of all the available output objects (series, diagnostics, parameters)
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
Examples
y<- ipi_c_eu[, "FR"]
user_defined_variables("X13-ARIMA")
m <- x13(y,"RSA5c", userdefined=c("b20","ycal","residuals.kurtosis" ))
m$user_defined$b20
m$user_defined$ycal
m$user_defined$residuals.kurtosis
user_defined_variables("TRAMO-SEATS")
m <- tramoseats(y,"RSAfull", userdefined=c("ycal","variancedecomposition.seasonality"))
m$user_defined$ycal
m$user_defined$variancedecomposition.seasonality
Seasonal Adjustment with X13-ARIMA
Description
Functions to estimate the seasonally adjusted series (sa) with the X13-ARIMA 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 (regarima) step.
x13
returns a preformatted result while jx13
returns the Java objects resulting from the seasonal adjustment.
Usage
jx13(
series,
spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3", "RSA4c", "X11"),
userdefined = NULL
)
x13(
series,
spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3", "RSA4c", "X11"),
userdefined = NULL
)
Arguments
series |
an univariate time series |
spec |
the x13 model specification. It can be the name ( |
userdefined |
a |
Details
The first step of a seasonal adjustment consists in pre-adjusting the time series. 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 X11 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
).
More information on the X11 algorithm at https://jdemetra-new-documentation.netlify.app/m-x11-decomposition.
The available pre-defined 'JDemetra+' X13 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) |
RSA2c | | automatic | | AO/LS/TC | | 2 td vars + Easter | | Airline(+mean) |
RSA3 | | automatic | | AO/LS/TC | | NA | | automatic |
RSA4c | | automatic | | AO/LS/TC | | 2 td vars + Easter | | automatic |
RSA5c | | automatic | | AO/LS/TC | | 7 td vars + Easter | | automatic |
X11 | | NA | | NA | | NA | | NA |
Value
jx13
returns the result of the seasonal adjustment in a Java (jSA
) object, without any formatting.
Therefore, the computation is faster than with the x13
function. The results of the seasonal adjustment can be
extracted with the function get_indicators
.
x13
returns an object of class c("SA","X13")
, that is, a list containing the following components:
regarima |
an object of class |
decomposition |
an object of class
|
final |
an object of class |
diagnostics |
an object of class
|
user_defined |
an object of class |
References
More information and examples related to 'JDemetra+' features in the online documentation: https://jdemetra-new-documentation.netlify.app/
See Also
Examples
myseries <- ipi_c_eu[, "FR"]
mysa <- x13(myseries, spec = "RSA5c")
myspec1 <- x13_spec(mysa, tradingdays.option = "WorkingDays",
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")
mysa1 <- x13(myseries, myspec1)
mysa1
summary(mysa1$regarima)
myspec2 <- x13_spec(mysa, automdl.enabled =FALSE,
arima.coefEnabled = TRUE,
arima.p = 1, arima.q = 1, arima.bp = 0, arima.bq = 1,
arima.coef = c(-0.8, -0.6, 0),
arima.coefType = c(rep("Fixed", 2), "Undefined"))
s_arimaCoef(myspec2)
mysa2 <- x13(myseries, myspec2,
userdefined = c("decomposition.d18", "decomposition.d19"))
mysa2
plot(mysa2)
plot(mysa2$regarima)
plot(mysa2$decomposition)
X-13ARIMA model specification, SA/X13
Description
Function to create (and/or modify) a c("SA_spec", "X13")
class object with the SA model specification for the X13 method.
It can be done from a pre-defined 'JDemetra+' model specification (a character
), a previous specification
(c("SA_spec", "X13")
object) or a seasonal adjustment model (c("SA", "X13")
object).
Usage
x13_spec(
spec = c("RSA5c", "RSA0", "RSA1", "RSA2c", "RSA3", "RSA4c", "X11"),
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_,
x11.mode = c(NA, "Undefined", "Additive", "Multiplicative", "LogAdditive",
"PseudoAdditive"),
x11.seasonalComp = NA,
x11.lsigma = NA_integer_,
x11.usigma = NA_integer_,
x11.trendAuto = NA,
x11.trendma = NA_integer_,
x11.seasonalma = NA_character_,
x11.fcasts = NA_integer_,
x11.bcasts = NA_integer_,
x11.calendarSigma = NA,
x11.sigmaVector = NA,
x11.excludeFcasts = NA,
benchmarking.enabled = NA,
benchmarking.target = c(NA, "Original", "CalendarAdjusted"),
benchmarking.useforecast = NA,
benchmarking.rho = NA_real_,
benchmarking.lambda = NA_real_
)
Arguments
spec |
an x13 model specification. It can be the 'JDemetra+' 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 ( |
x11.mode |
character: the decomposition mode. Determines the mode of the seasonal adjustment decomposition to be performed:
|
x11.seasonalComp |
logical: if |
x11.lsigma |
numeric: the lower sigma boundary for the detection of extreme values, > 0.5, default=1.5. |
x11.usigma |
numeric: the upper sigma boundary for the detection of extreme values, > lsigma, default=2.5. |
x11.trendAuto |
logical: automatic Henderson filter. If |
x11.trendma |
numeric: the length of the Henderson filter. The user-defined length of the Henderson filter.
The option is available when the automatic Henderson filter selection is disabled ( |
x11.seasonalma |
a vector of character(s) specifying which seasonal moving average (i.e. seasonal filter) will be used to estimate the seasonal factors for the entire series. The vector can be of length: 1 - the same seasonal filter is used for all periods (e.g.: 'seasonal.filter = "Msr"' or 'seasonal.filter = "S3X3"' ); or have a different value for each quarter (length 4) or each month (length 12) - (e.g. for quarterly series: 'seasonal.filter = c("S3X3", "Msr", "S3X3", "Msr")'). Possible filters are: '"Msr"', '"Stable"', '"X11Default"', '"S3X1"', '"S3X3"', '"S3X5"', '"S3X9"', '"S3X15"'. '"Msr"' - the program chooses the final seasonal filter automatically. |
x11.fcasts |
numeric: the number of forecasts generated by the RegARIMA model in periods (positive values) or years (negative values).Default value: fcasts=-1. |
x11.bcasts |
numeric: the number of backcasts used in X11. Negative figures are translated in years of backcasts. Default value: bcasts=0. |
x11.calendarSigma |
character to specify if the standard errors used for extreme values detection and adjustment are computed:
from 5 year spans of irregulars ( |
x11.sigmaVector |
a vector to specify one of the two groups of periods for whose standard errors used for extreme values
detection and adjustment will be computed. Only used if |
x11.excludeFcasts |
logical: to exclude forecasts and backcasts. If |
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. |
Details
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) |
RSA2c | | automatic | | AO/LS/TC | | 2 td vars + Easter | | Airline(+mean) |
RSA3 | | automatic | | AO/LS/TC | | NA | | automatic |
RSA4c | | automatic | | AO/LS/TC | | 2 td vars + Easter | | automatic |
RSA5c | | automatic | | AO/LS/TC | | 7 td vars + Easter | | automatic |
X11 | | NA | | NA | | NA | | NA |
Value
A two-element list of class c("SA_spec", "X13")
, containing:
(1) an object of class c("regarima_spec", "X13")
with the RegARIMA model specification;
(2) an object of class c("X11_spec", "data.frame")
with the X11 algorithm specification.
Each component refers to different parts 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) andFinal
values.-
regarima
: an object of classc("regarima_spec", "x13")
. See Value of the functionregarima_spec_x13
. -
x11
: a data.frame of classc("X11_spec", "data.frame")
, containing the x11 variables in line with the names of the arguments variables. The final values can be also accessed with the functions_x11
.
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
Examples
myseries <- ipi_c_eu[, "FR"]
myspec1 <- x13_spec(spec = "RSA5c")
myreg1 <- x13(myseries, spec = myspec1)
# To modify a pre-specified model specification
myspec2 <- x13_spec(spec = "RSA5c", tradingdays.option = "WorkingDays")
myreg2 <- x13(myseries, spec = myspec2)
# To modify the model specification of a "X13" object
myspec3 <- x13_spec(myreg1, tradingdays.option = "WorkingDays")
myreg3 <- x13(myseries, myspec3)
# To modify the model specification of a "X13_spec" object
myspec4 <- x13_spec(myspec1, tradingdays.option = "WorkingDays")
myreg4 <- x13(myseries, myspec4)
# Pre-specified outliers
myspec1 <- x13_spec(spec = "RSA5c", 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 <- x13(myseries, myspec1)
myreg1
s_preOut(myreg1)
# 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)
myspec1 <- x13_spec(spec = "RSA5c", tradingdays.option = "UserDefined",
usrdef.varEnabled = TRUE,
usrdef.var = var,
usrdef.varType = c("Calendar", "Calendar"))
myreg1 <- x13(myseries, myspec1)
myreg1
myspec2 <- x13_spec(spec = "RSA5c", usrdef.varEnabled = TRUE,
usrdef.var = var1, usrdef.varCoef = 2,
transform.function = "None")
myreg2 <- x13(myseries, myspec2)
s_preVar(myreg2)
# Pre-specified ARMA coefficients
myspec1 <- x13_spec(spec = "RSA5c", 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 <- x13(myseries, myspec1)
myreg1
# To define a seasonal filter
myspec1 <- x13_spec("RSA5c", x11.seasonalma = rep("S3X1", 12))
mysa1 <- x13(myseries, myspec1)