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-11-09 05:23:41 UTC |
Source: | https://github.com/rjdverse/rjd3x11plus |
Apply Henderson linear filter
henderson(x, length, musgrave = TRUE, ic = 4.5)
henderson(x, length, musgrave = TRUE, ic = 4.5)
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. |
A numeric array corresponding to the the trend
q<-x11plus(rjd3toolkit::ABS$X0.2.09.10.M, 12) henderson(q$decomposition$sa, 13)
q<-x11plus(rjd3toolkit::ABS$X0.2.09.10.M, 12) henderson(q$decomposition$sa, 13)
Compute IC-Ratio
ic_ratio(x, sc, mul = FALSE)
ic_ratio(x, sc, mul = FALSE)
x |
input time series. |
sc |
trend-cycle component. |
mul |
boolean indicating if the decomposition is multiplicative or additive. |
q<-x11plus(rjd3toolkit::retail$AllOtherGenMerchandiseStores, 12) x <- q$decomposition$sa sc <- henderson(x, length = 13, musgrave = FALSE) ic_ratio(x, sc)
q<-x11plus(rjd3toolkit::retail$AllOtherGenMerchandiseStores, 12) x <- q$decomposition$sa sc <- henderson(x, length = 13, musgrave = FALSE) ic_ratio(x, sc)
Get Macurves Filters
macurves(seas_filter = c("S3X3", "S3X1", "S3X5", "S3X9", "S3X15"), period = 12)
macurves(seas_filter = c("S3X3", "S3X1", "S3X5", "S3X9", "S3X15"), period = 12)
seas_filter |
the filter to extract. |
period |
period of the filter. |
macurves("S3X3")
macurves("S3X3")
X-11 Selection of Trend Filter
select_trend_filter(x, ...) ## Default S3 method: select_trend_filter(x, ..., freq) ## S3 method for class 'ts' select_trend_filter(x, ..., length = 13)
select_trend_filter(x, ...) ## Default S3 method: select_trend_filter(x, ..., freq) ## S3 method for class 'ts' select_trend_filter(x, ..., length = 13)
x |
I/C ratio |
... |
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. |
The following procedure is used in X-11 to select the length of the trend filter:
Computes the I/C ratio, with an Henderson filter of length 13.
The length depends on the value or :
if then the selected length is 9 for monthly data and 5 otherwise;
if then the selected length is
where
is the frequency of data (12 for monthly data, 4 for quarterly data...).
if then the selected length is 23 for monthly data and 7 otherwise.
# 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)
# 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
x11_extreme_values_corr( x, corrected_s, period, lsigma = 1.5, usigma = 2.5, mul = FALSE, start = 0, clean_extremities = TRUE )
x11_extreme_values_corr( x, corrected_s, period, lsigma = 1.5, usigma = 2.5, mul = FALSE, start = 0, clean_extremities = TRUE )
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 |
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. |
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.
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 )
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 )
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. |
An object of the class 'JD3_X11PLUS', containg the decomposition and the parameters
q<-x11plus(rjd3toolkit::ABS$X0.2.09.10.M, 12)
q<-x11plus(rjd3toolkit::ABS$X0.2.09.10.M, 12)
Perform the X-11 decomposition using custom trend filter
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 )
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 )
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 |
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. |
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")
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")