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)
I/C ratio ic_ratio()
or a time series
further arguments passed to or from other methods.
frequency of the time series used to compute the I/C ratio.
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, \(icr\) with an Henderson filter of length 13.
The length depends on the value or \(icr\):
if \(icr < 1\) then the selected length is 9 for monthly data and 5 otherwise;
if \(1 \leq icr < 3.5\) then the selected length is \(freq + 1\) where \(freq\) is the frequency of data (12 for monthly data, 4 for quarterly data...).
if \(icr \geq 3.5\) 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)
#> icr length
#> 3.720734 23.000000
# Because Henderson filter is used, this is equivalent to:
select_trend_filter(x)
#> icr length
#> 3.720734 23.000000