library("rjd3production")The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
library("rjd3production")The {rjd3production} package is useful for setting up a production pipeline for seasonally adjusted time series.
Before creating our production pipeline, we need to set up our working environment – our project. The init_env() function creates the following structure:
data/ folder: our raw dataWorkspaces/ folder: our workspacesoutput/ folder: the output time series, tables and graphsspecs/ folder: workspace-specific specifications (calendar regressors, outliers, etc.)BQ/ folder: quality reports and decision files.lintr file for static code analysis (formatting best practices)path_project <- tempfile(pattern = "my_sa_project")
init_env(path = path_project)In this tutorial, we will create a production pipeline using the ABS dataset from the {rjd3toolkit} package. The dataset is also available as the file ABS.csv at /usr/local/lib/R/site-library/rjd3providers/extdata/ABS.csv in the {rjd3providers} package.
library("rjd3toolkit")
path_ABS <- system.file("extdata", "ABS.csv", package = "rjd3providers")
my_data <- ABS[, seq_len(3L)]
colnames(my_data) <- substr(colnames(my_data), start = 2L, stop = 12L)If our time series are sensitive to calendar effects, we can correct for these effects using calendar regressors.
To do this, refer to the td-selection vignette for guidance on how to handle these effects and how to generate the td table containing our selected custom calendar regressors.
td <- select_td(my_data)
#>
#> Série 0.2.09.10.M en cours... 1/3
#> Computing spec No_TD ...Done !
#> Computing spec REG1 ...Done !
#> Computing spec REG2 ...Done !
#> Computing spec REG3 ...Done !
#> Computing spec REG5 ...Done !
#> Computing spec REG6 ...Done !
#> Computing spec LY ...Done !
#> Computing spec REG1_LY ...Done !
#> Computing spec REG2_LY ...Done !
#> Computing spec REG3_LY ...Done !
#> Computing spec REG5_LY ...Done !
#> Computing spec REG6_LY ...Done !
#>
#> Série 0.2.08.10.M en cours... 2/3
#> Computing spec No_TD ...Done !
#> Computing spec REG1 ...Done !
#> Computing spec REG2 ...Done !
#> Computing spec REG3 ...Done !
#> Computing spec REG5 ...Done !
#> Computing spec REG6 ...Done !
#> Computing spec LY ...Done !
#> Computing spec REG1_LY ...Done !
#> Computing spec REG2_LY ...Done !
#> Computing spec REG3_LY ...Done !
#> Computing spec REG5_LY ...Done !
#> Computing spec REG6_LY ...Done !
#>
#> Série 0.2.07.10.M en cours... 3/3
#> Computing spec No_TD ...Done !
#> Computing spec REG1 ...Done !
#> Computing spec REG2 ...Done !
#> Computing spec REG3 ...Done !
#> Computing spec REG5 ...Done !
#> Computing spec REG6 ...Done !
#> Computing spec LY ...Done !
#> Computing spec REG1_LY ...Done !
#> Computing spec REG2_LY ...Done !
#> Computing spec REG3_LY ...Done !
#> Computing spec REG5_LY ...Done !
#> Computing spec REG6_LY ...Done !We will use the {rjd3workspace} package for functions relating to the creation and manipulation of workspaces.
library("rjd3workspace")To create a new workspace, you can either create it manually from scratch or from a dataset. If you are using external variables, calendar regressors or a custom calendar, don’t forget to place all of these within a modelling context.
At INSEE, we use the create_insee_context() function to create our contexts:
my_context <- create_insee_context(s = my_data[, 1L])We will use the {rjd3x13} package to create the X13 specs.
library("rjd3x13")jws <- jws_new(modelling_context = my_context)
jsap <- jws_sap_new(jws, "Nouveau SAP")
add_sa_item(jsap = jsap, name = "Première série", x = my_data[, 1L], spec = x13_spec())
add_sa_item(jsap = jsap, name = "Seconde série", x = my_data[, 2L], spec = x13_spec())
#... avec autant de commande que de sériesjws <- create_ws_from_data(my_data)
set_context(jws, create_insee_context(s = my_data))If we have any, we need to assign calendar regressors to each series:
jws_compute(jws)
assign_td(td = td, jws = jws)
#> Série 0.2.09.10.M, 1/3
#> Série 0.2.08.10.M, 2/3
#> Série 0.2.07.10.M, 3/3Don’t forget to update the metadata for our workspace with the path to our raw data:
add_raw_data_path(jws, path_ABS, delimiter = "COMMA")At last, we can save our workspace!
path_ws <- file.path(path_project, "Workspaces", "workspace_travail", "my_ws.xml")
save_workspace(jws, path_ws, replace = TRUE)In an R production pipeline, the cruncher plays a vital role as it enables:
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.