Package 'rjd3x11plus'

Title: Interface to 'JDemetra+ 3.x' time series analysis software
Description: R Interface to 'JDemetra+ 3.x' (<https://github.com/jdemetra>) time series analysis software.
Authors: Jean Palate [aut, cre]
Maintainer: Jean Palate <[email protected]>
License: EUPL
Version: 2.1.1.9000
Built: 2024-09-10 05:25:45 UTC
Source: https://github.com/rjdverse/rjd3x11plus

Help Index


Apply Henderson linear filter

Description

Apply Henderson linear filter

Usage

henderson(x, length, musgrave = TRUE, ic = 4.5)

Arguments

x

input time-series.

length

length of the Henderson filter.

musgrave

Boolean indicating if Musgrave asymmetric filters should be used.

ic

ic ratio: irregular/trend-cycle.

Value

A numeric array corresponding to the the trend

Examples

q<-x11plus(rjd3toolkit::ABS$X0.2.09.10.M, 12)

henderson(q$decomposition$sa, 13)

Compute IC-Ratio

Description

Compute IC-Ratio

Usage

ic_ratio(x, sc, mul = FALSE)

Arguments

x

input time series.

sc

trend-cycle component.

mul

boolean indicating if the decomposition is multiplicative or additive.

Examples

q<-x11plus(rjd3toolkit::retail$AllOtherGenMerchandiseStores, 12)
x <- q$decomposition$sa
sc <- henderson(x, length = 13, musgrave = FALSE)
ic_ratio(x, sc)

Get Macurves Filters

Description

Get Macurves Filters

Usage

macurves(seas_filter = c("S3X3", "S3X1", "S3X5", "S3X9", "S3X15"), period = 12)

Arguments

seas_filter

the filter to extract.

period

period of the filter.

Examples

macurves("S3X3")

X-11 Selection of Trend Filter

Description

X-11 Selection of Trend Filter

Usage

select_trend_filter(x, ...)

## Default S3 method:
select_trend_filter(x, ..., freq)

## S3 method for class 'ts'
select_trend_filter(x, ..., length = 13)

Arguments

x

I/C ratio ic_ratio() or a time series

...

further arguments passed to or from other methods.

freq

frequency of the time series used to compute the I/C ratio.

length

length of the Henderson filter used to compute the I/C ratio.

Details

The following procedure is used in X-11 to select the length of the trend filter:

  1. Computes the I/C ratio, icricr with an Henderson filter of length 13.

  2. The length depends on the value or icricr:

    • if icr<1icr < 1 then the selected length is 9 for monthly data and 5 otherwise;

    • if 1icr<3.51 \leq icr < 3.5 then the selected length is freq+1freq + 1 where freqfreq is the frequency of data (12 for monthly data, 4 for quarterly data...).

    • if icr3.5icr \geq 3.5 then the selected length is 23 for monthly data and 7 otherwise.

Examples

# example code
s<-rjd3toolkit::retail$AllOtherGenMerchandiseStores
q<-x11plus(s, 12)
x <- ts(data=q$decomposition$sa, start=start(s), frequency=frequency(s))
sc <- henderson(x, length = 13, musgrave = FALSE)
icr <- ic_ratio(x, sc)
select_trend_filter(icr, freq = 12)
# Because Henderson filter is used, this is equivalent to:
select_trend_filter(x)

'X11' Extreme Values Corrector

Description

'X11' Extreme Values Corrector

Usage

x11_extreme_values_corr(
  x,
  corrected_s,
  period,
  lsigma = 1.5,
  usigma = 2.5,
  mul = FALSE,
  start = 0,
  clean_extremities = TRUE
)

Arguments

x

the analysed time series.

corrected_s

other time series if the series being corrected is different from x.

period

the period of the input time series if x is not a "ts" object.

lsigma, usigma

the lower and the upper sigma boundaries for the detection of extreme values.

mul

boolean indicating if the decomposition is multiplicative or additive.

start

position of the first "complete" considered period.

clean_extremities

boolean indicating if the extremities should be cleaned.

Details

The 'X11' Extreme Values Corrector is used to compute the tables b4, b4g, b9, b9g, b17, b20, c17 and c20.


Perform an X-11 like decomposition with any (non integer) periodicity.

Description

Perform an X-11 like decomposition with any (non integer) periodicity.

Usage

x11plus(
  y,
  period,
  mul = TRUE,
  trend.horizon = 6,
  trend.degree = 2,
  trend.kernel = c("Henderson", "BiWeight", "TriWeight", "TriCube", "Uniform",
    "Triangular", "Epanechnikov", "Trapezoidal"),
  trend.asymmetric = c("CutAndNormalize", "Direct", "MMSRE"),
  seas.s0 = c("S3X3", "S3X1", "S3X5", "S3X9", "S3X15"),
  seas.s1 = c("S3X5", "S3X3", "S3X1", "S3X9", "S3X15"),
  extreme.lsig = 1.5,
  extreme.usig = 2.5
)

Arguments

y

input time-series.

period

Period of the seasonal component, any positive real number.

mul

Boolean indicating if the decomposition mode is multiplicative (TRUE).

trend.horizon

bandwidth of trend filters.

trend.degree

polynomial order in local trend model.

trend.kernel

kernel weights in objective function.

trend.asymmetric

truncation type for symmetric filter.

seas.s0

Seasonal filter for B5, C5, D5.

seas.s1

seasonal filter for B10, C10, D10.

extreme.lsig

lower boundary used for outlier correction in irregular.

extreme.usig

upper boundary used for outlier correction in irregular.

Value

An object of the class 'JD3_X11PLUS', containg the decomposition and the parameters

Examples

q<-x11plus(rjd3toolkit::ABS$X0.2.09.10.M, 12)

X-11 Decomposition With Custom Trend Filters

Description

Perform the X-11 decomposition using custom trend filter

Usage

x11plus_trend(
  x,
  period = frequency(x),
  trend.coefs,
  mul = TRUE,
  seas.s0 = c("S3X3", "S3X1", "S3X5", "S3X9", "S3X15"),
  seas.s1 = c("S3X5", "S3X3", "S3X1", "S3X9", "S3X15"),
  extreme.lsig = 1.5,
  extreme.usig = 2.5,
  userdefined = NULL
)

Arguments

x

input time-series.

period

period.

trend.coefs

coefficients of the filters used for the trend-cycle extraction from the real-time asymmetric filter to the symmetric filter. Can be a, object of class "list", "matrix", "lp_filter" or "rkhs_filter".

mul

boolean indicating if the decomposition mode is multiplicative.

seas.s0, seas.s1

seasonal filters.

extreme.lsig, extreme.usig

boundaries used for outlier correction in irregular.

userdefined

a vector containing the additional output variables.

Examples

q<-x11plus(rjd3toolkit::retail$AllOtherGenMerchandiseStores, 12)
x <- q$decomposition$sa
decomposition_lp <- x11plus_trend(x, trend.coefs = rjd3filters::lp_filter())
decomposition_rkhs <- x11plus_trend(x, trend.coefs = rjd3filters::rkhs_filter())
plot(x)
lines(decomposition_lp$decomposition[,"t"], col = "red")
lines(decomposition_rkhs$decomposition[,"t"], col = "green")