This function updates a Demetra+ workspace (.xml) by inserting pre-specified outliers into the domainSpec of each seasonal adjustment model (SAI). Typically, the list of outliers is created with retrieve_outliers() and stored/exported with export_outliers().

affect_outliers(outliers, ws_path)

Arguments

outliers

[list] A named list where each element corresponds to a series in the workspace. Each element should be a character vector of outlier specifications (e.g. "AO (2020-03)", "LS (2008-09)").

ws_path

[character] Path to a Demetra+ workspace file (usually with extension .xml).

Value

Invisibly returns NULL. The workspace file at ws_path is updated on disk with the new outliers.

Details

For each series in the workspace:

  • The function looks up the corresponding entry in the outliers list.

  • If outliers are specified, they are split into type (AO, LS, TC, …) and date (e.g. "2020-03") using regex patterns.

  • These outliers are then added into the domainSpec of the model using rjd3toolkit::add_outlier().

The modified workspace is saved in place (argument replace = TRUE).

See also

Examples

if (FALSE) { # \dontrun{
# Retrieve outliers from an existing workspace
outs <- retrieve_outliers("workspace.xml")

# Reapply them to another workspace
affect_outliers(outliers = outs, ws_path = "workspace.xml")
} # }