select_trend_filter: X-11 Selection of Trend Filter

View source: R/ic_r.R

select_trend_filterR Documentation

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, icr with an Henderson filter of length 13.

  2. 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.

Examples

# example code
x <- retailsa$AllOtherGenMerchandiseStores
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)

palatej/rjdfilters documentation built on May 8, 2023, 6:28 a.m.