Skip to contents

Update an x13_spec output object with outliers from an x13 output object.

Usage

update_spec_outliers(
  sa,
  spec = NULL,
  day = "01",
  verbose = FALSE,
  input_output = is.null(spec)
)

update_outliers(sa, spec, day = "01", null_when_no_new = TRUE, verbose = FALSE)

Arguments

sa

An x13 output object

spec

An x13_spec output object

day

Day of month as character to be used in outlier coding

verbose

Printing information to console when TRUE.

input_output

When TRUE output is a list of x13_spec parameters instead of an updated spec.

null_when_no_new

Whether to return NULL when no new outliers found.

Value

update_spec_outliers returns an updated x13_spec output object with new outliers and updated outlier.from. update_outliers returns a data frame with outlier variables used to update.

Note

For special use, parameter sa to update_outliers can be a data frame of outliers (as created by corona_outliers).

Examples

myseries <- ipi_c_eu[, "FR"]

spec_1 <- x13_spec(spec = "RSA3", transform.function = "None", usrdef.outliersEnabled = TRUE, 
                   usrdef.outliersType = "AO", usrdef.outliersDate = "2007-03-01", 
                   outlier.usedefcv = FALSE, outlier.cv = 3)
                   
spec_2 <- x13_spec(spec_1, estimate.to = "2018-08-01")

a <- x13(myseries, spec_2)

update_outliers(a, spec_1)
#>   type       date
#> 1   AO 2007-03-01
#> 2   LS 2008-11-01
#> 3   AO 2011-05-01
#> 4   TC 2009-02-01
#> 5   LS 1997-04-01
#> 6   TC 2017-10-01

spec_3 <- update_spec_outliers(a, spec_1)

s_span(spec_1)
#>          type   d0   d1 n0 n1
#> estimate  All <NA> <NA>  0  0
#> outlier   All <NA> <NA>  0  0
s_span(spec_2)
#>          type   d0         d1 n0 n1
#> estimate   To <NA> 2018-08-01  0  0
#> outlier   All <NA>       <NA>  0  0
s_span(spec_3)
#>          type         d0   d1 n0 n1
#> estimate  All       <NA> <NA>  0  0
#> outlier  From 2018-08-01 <NA>  0  0

s_preOut(spec_1)
#>   type       date coeff
#> 1   AO 2007-03-01    NA
s_preOut(spec_2)
#>   type       date coeff
#> 1   AO 2007-03-01    NA
s_preOut(spec_3)
#>   type       date coeff
#> 1   AO 2007-03-01    NA
#> 2   LS 2008-11-01    NA
#> 3   AO 2011-05-01    NA
#> 4   TC 2009-02-01    NA
#> 5   LS 1997-04-01    NA
#> 6   TC 2017-10-01    NA

update_spec_outliers(a)
#> $outlier.from
#> [1] "2018-08-01"
#> 
#> $usrdef.outliersEnabled
#> [1] TRUE
#> 
#> $usrdef.outliersType
#> [1] "AO" "LS" "AO" "TC" "LS" "TC"
#> 
#> $usrdef.outliersDate
#> [1] "2007-03-01" "2008-11-01" "2011-05-01" "2009-02-01" "1997-04-01"
#> [6] "2017-10-01"
#>