Title: | Interface to 'JDemetra+ 3.x' time series analysis software. |
---|---|
Description: | R Interface to 'JDemetra+ 3.x' (<https://github.com/jdemetra>). It offers several functions to manipulate 'JDemetra+' workspaces, which can be read by the software and can store several seasonal adjusted series along with user-defined calendars or regression variables. |
Authors: | Jean Palate [aut], Alain Quartier-la-Tente [aut] , Tanguy Barthelemy [aut, cre, art], Anna Smyk [aut] |
Maintainer: | Tanguy Barthelemy <[email protected]> |
License: | EUPL |
Version: | 3.2.3.9000 |
Built: | 2024-11-18 05:09:27 UTC |
Source: | https://github.com/rjdverse/rjd3workspace |
Extract specific metadata or time series metadata of a SAItem.
.jsa_metadata(jsa, key) .jsa_ts_metadata(jsa, key)
.jsa_metadata(jsa, key) .jsa_ts_metadata(jsa, key)
jsa |
Java SAItem object. |
key |
key of the metadata. |
.jsa_results()
extracts specific variables of the model of the SAItem while
.jsa_read()
extracts all the informations of a SAItem (see details).
.jsa_jresults()
extracts the Java object of the results of a SAItem.
.jsa_read(jsa) .jsa_results(jsa, items = NULL) .jsa_jresults(jsa)
.jsa_read(jsa) .jsa_results(jsa, items = NULL) .jsa_jresults(jsa)
jsa |
Java SAItem object. |
items |
vector of characters containing the variables to extract.
See |
A SAItem contains more information than just the results of a model.
All those informations are extracted with the .jsa_read()
function that returns a list with 5 objects:
ts
: the raw time series.
domainSpec
: initial specification. Reference for any relaxing of some elements of the specification.
estimationSpec
: specification used for the current estimation.
pointSpec
: specification corresponding to the results of the current estimation (fully identified model).
results
: the result of the model.
Functions to retrieve the name of a SAProcessing (.jsap_name()
) or SaItem (.jsa_name()
).
This function is used to retrieve the Java names of all the sa_items
contained in a SA-Processing
.
.jsa_name(jsa) .jsap_name(jsap) .jsap_sa_name(jsap)
.jsa_name(jsa) .jsap_name(jsap) .jsap_sa_name(jsap)
jsap , jsa
|
the object to retrieve the name from. |
jsap |
the java object representing the |
A vector character
.
Other functions to retrieve the name of JDemetra+ objects (workspace
, SA-Processing
or sa-item
): .jsa_name
, .jsap_name
.
y <- rjd3toolkit::ABS$X0.2.09.10.M jws <- .jws_new() jsap1 <- .jws_sap_new(jws, "sa1") add_sa_item(jsap1, name = "x13", x = rjd3x13::x13(y)) add_sa_item(jsap1, name = "tramo", x = rjd3tramoseats::tramoseats(y)) add_sa_item(jsap1, name = "x13-2", x = y, rjd3x13::x13_spec()) add_sa_item(jsap1, name = "tramo-2", x = y, rjd3tramoseats::tramoseats_spec()) print(.jsap_sa_name(jsap1))
y <- rjd3toolkit::ABS$X0.2.09.10.M jws <- .jws_new() jsap1 <- .jws_sap_new(jws, "sa1") add_sa_item(jsap1, name = "x13", x = rjd3x13::x13(y)) add_sa_item(jsap1, name = "tramo", x = rjd3tramoseats::tramoseats(y)) add_sa_item(jsap1, name = "x13-2", x = y, rjd3x13::x13_spec()) add_sa_item(jsap1, name = "tramo-2", x = y, rjd3tramoseats::tramoseats_spec()) print(.jsap_sa_name(jsap1))
Functions to create a 'JDemetra+' workspace (.jws_new()
) and
to add a new multi-processing (.jws_sap_new()
).
.jws_new(modelling_context = NULL) .jws_sap_new(jws, name)
.jws_new(modelling_context = NULL) .jws_sap_new(jws, name)
modelling_context |
The context (from |
jws |
A workspace object. |
name |
Character name of the new SAProcessing. |
# To create an empty 'JDemetra+' workspace jwk <- .jws_new() jsap <- .jws_sap_new(jwk, "sa1")
# To create an empty 'JDemetra+' workspace jwk <- .jws_new() jsap <- .jws_sap_new(jwk, "sa1")
.jws_open()
loads a workspace and .jws_compute()
computes it (to be able to get all the models).
.jws_open(file) .jws_load(file)
.jws_open(file) .jws_load(file)
file |
the path to the 'JDemetra+' workspace to load. By default a dialog box opens. |
read_workspace()
to import all the models of a workspace.
Extract a SAProcessing or a SaItem
.jsap_sa(jsap, idx) .jws_sap(jws, idx)
.jsap_sa(jsap, idx) .jws_sap(jws, idx)
idx |
index of the object to extract. |
jws , jsap
|
the workspace or the SAProcessing. |
Functions to count the number of SAProcessing inside a workspace (jws_sap_count
) or
the number of SaItem inside a SAProcessing (jsap_sa_count
).
.jsap_sa_count(jsap) .jws_sap_count(jws)
.jsap_sa_count(jsap) .jws_sap_count(jws)
jws , jsap
|
the workspace or the SAProcessing. |
Add Calendar to Workspace
add_calendar(jws, name, calendar)
add_calendar(jws, name, calendar)
jws |
A workspace object. |
name |
the name of the calendar to add. |
calendar |
the calendar to add. |
Add SAItem to SAProcessing
add_sa_item(jsap, name, x, spec, ...)
add_sa_item(jsap, name, x, spec, ...)
jsap |
the SAProcessing. |
name |
the name of SAItem. |
x |
either a seasonal adjustment model (from |
spec |
the specification to use when |
... |
other unused parameters. |
dir <- tempdir() y <- rjd3toolkit::ABS$X0.2.09.10.M jws <- .jws_new() jsap1 <- .jws_sap_new(jws, "sa1") add_sa_item(jsap1, name = "x13", x = rjd3x13::x13(y)) add_sa_item(jsap1, name = "tramo", x = rjd3tramoseats::tramoseats(y)) add_sa_item(jsap1, name = "x13-2", x = y, rjd3x13::x13_spec()) add_sa_item(jsap1, name = "tramo-2", x = y, rjd3tramoseats::tramoseats_spec()) save_workspace(jws, file.path(dir, "workspace.xml"))
dir <- tempdir() y <- rjd3toolkit::ABS$X0.2.09.10.M jws <- .jws_new() jsap1 <- .jws_sap_new(jws, "sa1") add_sa_item(jsap1, name = "x13", x = rjd3x13::x13(y)) add_sa_item(jsap1, name = "tramo", x = rjd3tramoseats::tramoseats(y)) add_sa_item(jsap1, name = "x13-2", x = y, rjd3x13::x13_spec()) add_sa_item(jsap1, name = "tramo-2", x = y, rjd3tramoseats::tramoseats_spec()) save_workspace(jws, file.path(dir, "workspace.xml"))
Add Variable to Workspace
add_variable(jws, group, name, y)
add_variable(jws, group, name, y)
jws |
A workspace object. |
group , name
|
the group and the name of the variable to add. |
y |
the variable (a |
Deprecated functions
.jmp_sa_count(jmp) .jmp_name(jmp) .jmp_sa(jmp, idx) .jmp_sa_name(jmp) .jmp_load(jmp) .jws_multiprocessing(jws, idx) .jws_multiprocessing_new(jws, name) .jws_multiprocessing_count(jws)
.jmp_sa_count(jmp) .jmp_name(jmp) .jmp_sa(jmp, idx) .jmp_sa_name(jmp) .jmp_load(jmp) .jws_multiprocessing(jws, idx) .jws_multiprocessing_new(jws, name) .jws_multiprocessing_count(jws)
jmp , idx , jws , name
|
Parameters. |
Get Context from Workspace
get_context(jws)
get_context(jws)
jws |
the workspace. |
Copy Workspace or a SAProcessing
.jsap_make_copy(jsap) .jws_make_copy(jws)
.jsap_make_copy(jsap) .jws_make_copy(jws)
jws , jsap
|
Java Workspace or Multiprocessing |
Functions to read all the SAItem of a SAProcessing (read_sap()
)
or a workspace (read_workspace()
).
The functions .jread_sap()
and .jread_workspace()
only returns the Java objects
read_sap(jsap) .jread_sap(jsap) read_workspace(jws, compute = TRUE) .jread_workspace(jws, compute = TRUE)
read_sap(jsap) .jread_sap(jsap) read_workspace(jws, compute = TRUE) .jread_workspace(jws, compute = TRUE)
jsap |
Java SAProcessing. |
jws |
Java workspace. |
compute |
Compute the workspace. |
file <- system.file("workspaces", "test.xml", package = "rjd3workspace") jws <- .jws_load(file) # We don't compute the workspace rws <- read_workspace(jws, FALSE)
file <- system.file("workspaces", "test.xml", package = "rjd3workspace") jws <- .jws_load(file) # We don't compute the workspace rws <- read_workspace(jws, FALSE)
Refresh Workspace or SAProcessing
.jsap_refresh( jsap, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed"), period = 0, start = NULL, end = NULL, info = c("All", "Data", "None") ) .jws_refresh( jws, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed"), period = 0, start = NULL, end = NULL, info = c("All", "Data", "None") )
.jsap_refresh( jsap, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed"), period = 0, start = NULL, end = NULL, info = c("All", "Data", "None") ) .jws_refresh( jws, policy = c("FreeParameters", "Complete", "Outliers_StochasticComponent", "Outliers", "FixedParameters", "FixedAutoRegressiveParameters", "Fixed"), period = 0, start = NULL, end = NULL, info = c("All", "Data", "None") )
policy |
the refresh policy to apply (see details). |
period , start , end
|
to specify the span on which outliers will not be re-identified (i.e.: re-detected) when |
info |
information to refresh. |
jws , jsap
|
Java Workspace or Multiprocessing |
Available refresh policies are:
Current: applying the current pre-adjustment reg-arima model and adding the new raw data points as Additive Outliers (defined as new intervention variables)
Fixed: applying the current pre-adjustment reg-arima model and replacing forecasts by new raw data points.
FixedParameters: pre-adjustment reg-arima model is partially modified: regression coefficients will be re-estimated but regression variables, Arima orders and coefficients are unchanged.
FixedAutoRegressiveParameters: same as FixedParameters but Arima Moving Average coefficients (MA) are also re-estimated, Auto-regressive (AR) coefficients are kept fixed.
FreeParameters: all regression and Arima model coefficients are re-estimated, regression variables and Arima orders are kept fixed.
Outliers: regression variables and Arima orders are kept fixed, but outliers will be re-detected on the defined span, thus all regression and Arima model coefficients are re-estimated
Outliers_StochasticComponent: same as "Outliers" but Arima model orders (p,d,q)(P,D,Q) can also be re-identified.
Title
regarima_write_spec(spec, file)
regarima_write_spec(spec, file)
file |
replace_sa_item()
replaces a SaItem of a SAProcessing and remove_sa_item()
removes a SaItem from a SAProcessing
This functions clear a SA-Processing
by removing all the sa-item contained.
replace_sa_item(jsap, idx, jsa) remove_sa_item(jsap, idx) remove_all_sa_item(jsap) transfer_series(jsap_from, jsap_to, selected_series, print_indications = TRUE)
replace_sa_item(jsap, idx, jsa) remove_sa_item(jsap, idx) remove_all_sa_item(jsap) transfer_series(jsap_from, jsap_to, selected_series, print_indications = TRUE)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
jsa |
the new SaItem. |
jsap_from |
The SA-Processing from which to take the series |
jsap_to |
The SA-Processing in which to paste the series |
selected_series |
The vector containing the series-to-update's names. |
print_indications |
A boolean to print indications on the processing status (optional) |
If selected_series
is missing, all series from jsap_from
will be copied.
In this context, the word series refers to sa-item
.
NULL
returned invisibly
NULL
returned invisibly
Save Workspace
save_workspace(jws, file, replace = FALSE)
save_workspace(jws, file, replace = FALSE)
jws |
the workspace object to export. |
file |
the path where to export the 'JDemetra+' workspace (.xml file). |
replace |
boolean indicating if the workspace should be replaced if it already exists. |
dir <- tempdir() jws <- .jws_new() jsap1 <- .jws_sap_new(jws, "sa1") y <- rjd3toolkit::ABS$X0.2.09.10.M add_sa_item(jsap1, name = "x13", x = y, rjd3x13::x13_spec()) save_workspace(jws, file.path(dir, "workspace.xml"))
dir <- tempdir() jws <- .jws_new() jsap1 <- .jws_sap_new(jws, "sa1") y <- rjd3toolkit::ABS$X0.2.09.10.M add_sa_item(jsap1, name = "x13", x = y, rjd3x13::x13_spec()) save_workspace(jws, file.path(dir, "workspace.xml"))
Get/Set SaItem Comment
set_comment(jsap, idx, comment) get_comment(jsa)
set_comment(jsap, idx, comment) get_comment(jsa)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
comment |
character containing the comment. |
jsa |
a SaItem. |
Set Context of a Workspace
set_context(jws, modelling_context = NULL)
set_context(jws, modelling_context = NULL)
jws |
A workspace object. |
modelling_context |
The context (from |
Set the name associated to a SaItem Comment
set_name(jsap, idx, name)
set_name(jsap, idx, name)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
name |
character containing the name of the SAItem. |
Get/Set SaItem Priority
set_priority(jsap, idx, priority = 0) get_priority(jsa)
set_priority(jsap, idx, priority = 0) get_priority(jsa)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
priority |
integer containing the priority. |
jsa |
a SaItem. |
Get/Set the Raw Data of a SaItem
set_raw_data(jsap, idx, y) get_raw_data(jsa)
set_raw_data(jsap, idx, y) get_raw_data(jsa)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
y |
the new raw time serie. |
jsa |
a SaItem. |
Set Specification or Data of a SaItem
set_specification(jsap, idx, spec) set_domain_specification(jsap, idx, spec)
set_specification(jsap, idx, spec) set_domain_specification(jsap, idx, spec)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
spec |
the new specification. |
Get/Set the time series of a SaItem
set_ts(jsap, idx, y) get_ts(jsa)
set_ts(jsap, idx, y) get_ts(jsa)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
y |
a "full" time series (jd3-like). |
jsa |
a SaItem. |
Function to set the time series metadata of a SaItem (provider, source of the data...).
set_ts_metadata()
uses the metadata of another SaItem while put_ts_metadata()
allows to update a specific key with a new information.
set_ts_metadata(jsap, idx, ref_jsa) put_ts_metadata(jsap, idx, key, value)
set_ts_metadata(jsap, idx, ref_jsa) put_ts_metadata(jsap, idx, key, value)
jsap |
the SAProcessing to modify. |
idx |
index of the target SaItem. |
ref_jsa |
a reference SaItem containing the metadata. |
key |
key of the metadata. |
value |
value of the metadata. |
# Change the file of a given item file <- system.file("workspaces", "test.xml", package = "rjd3workspace") jws <- .jws_load(file) jsap <- .jws_sap(jws, 1) jsa <- .jsap_sa(jsap, 1) nid <- rjd3providers::spreadsheet_change_file(.jsa_ts_metadata(jsa, "@id"), "test.xlsx") put_ts_metadata(jsap, 1, "@id", nid) jsa <- .jsap_sa(jsap, 1) .jsa_ts_metadata(jsa, "@id")
# Change the file of a given item file <- system.file("workspaces", "test.xml", package = "rjd3workspace") jws <- .jws_load(file) jsap <- .jws_sap(jws, 1) jsa <- .jsap_sa(jsap, 1) nid <- rjd3providers::spreadsheet_change_file(.jsa_ts_metadata(jsa, "@id"), "test.xlsx") put_ts_metadata(jsap, 1, "@id", nid) jsa <- .jsap_sa(jsap, 1) .jsa_ts_metadata(jsa, "@id")
Title
tramo_write_spec(spec, file)
tramo_write_spec(spec, file)
file |
Title
tramoseats_write_spec(spec, file)
tramoseats_write_spec(spec, file)
file |
Title
write_calendars(calendars, file)
write_calendars(calendars, file)
file |
Title
write_variables(vars, file)
write_variables(vars, file)
file |