Manipulating Finite Filters
Usage
finite_filters(
sfilter,
rfilters = NULL,
lfilters = NULL,
first_to_last = FALSE
)
is.finite_filters(x)
# S4 method for class 'finite_filters'
show(object)Arguments
- sfilter
the symmetric filter (
moving_average()object) or amatrixorlistwith all the coefficients.- rfilters
the right filters (used on the last points).
- lfilters
the left filters (used on the first points).
- first_to_last
boolean indicating if the first element of
rfiltersis the first asymmetric filter (when only one observation is missing) or the last one (real-time estimates).- x
object to test the class.
- object
finite_filtersobject.
Examples
ff_lp <- lp_filter()
ff_simple_ma <- finite_filters(moving_average(c(1, 1, 1), lags = -1)/3,
rfilters = list(moving_average(c(1, 1), lags = -1)/2))
ff_lp
#> q=6 q=5 q=4 q=3 q=2
#> t-6 -0.01934985 -0.016429821 -0.010992405 -0.008134877 -0.016032761
#> t-5 -0.02786378 -0.025767846 -0.022036255 -0.020190215 -0.024868237
#> t-4 0.00000000 0.001271838 0.003297605 0.004132155 0.002673996
#> t-3 0.06549178 0.065939529 0.066259471 0.066082532 0.067844235
#> t-2 0.14735651 0.146980166 0.145594283 0.144405855 0.149387420
#> t-1 0.21433675 0.213136306 0.210044599 0.207844681 0.216046109
#> t 0.24005716 0.238032623 0.233235092 0.230023684 0.241444975
#> t+1 0.21433675 0.211488120 0.204984764 0.200761868 0.215403021
#> t+2 0.14735651 0.143683794 0.135474614 0.130240227 0.148101243
#> t+3 0.06549178 0.060994971 0.051079966 0.044834091 0.000000000
#> t+4 0.00000000 -0.005320905 -0.016941735 0.000000000 0.000000000
#> t+5 -0.02786378 -0.034008775 0.000000000 0.000000000 0.000000000
#> t+6 -0.01934985 0.000000000 0.000000000 0.000000000 0.000000000
#> q=1 q=0
#> t-6 -0.042706925 -0.09186038
#> t-5 -0.038631881 -0.05811026
#> t-4 0.001820871 0.01201758
#> t-3 0.079901630 0.11977342
#> t-2 0.174355336 0.24390220
#> t-1 0.253924544 0.35314649
#> t 0.292233930 0.42113096
#> t+1 0.279102495 0.00000000
#> t+2 0.000000000 0.00000000
#> t+3 0.000000000 0.00000000
#> t+4 0.000000000 0.00000000
#> t+5 0.000000000 0.00000000
#> t+6 0.000000000 0.00000000
ff_simple_ma
#> q=1 q=0
#> t-1 0.3333333 0.5
#> t 0.3333333 0.5
#> t+1 0.3333333 0.0
ff_lp * ff_simple_ma
#> q=7 q=6 q=5 q=4 q=3
#> t-7 -0.006449948 -0.006449948 -0.005476607 -0.003664135 -0.002711626
#> t-6 -0.015737874 -0.015737874 -0.014065889 -0.011009553 -0.009441697
#> t-5 -0.015737874 -0.015737874 -0.013641943 -0.009910352 -0.008064312
#> t-4 0.012542669 0.012542669 0.013814507 0.015840274 0.016674824
#> t-3 0.070949432 0.070949432 0.071397178 0.071717120 0.071540180
#> t-2 0.142395015 0.142395015 0.142018667 0.140632785 0.139444356
#> t-1 0.200583472 0.200583472 0.199383032 0.196291325 0.194091407
#> t 0.222910217 0.222910217 0.220885683 0.216088152 0.212876744
#> t+1 0.200583472 0.200583472 0.197734846 0.191231490 0.187008593
#> t+2 0.142395015 0.142395015 0.138722295 0.130513115 0.132751077
#> t+3 0.070949432 0.070949432 0.066452620 0.053713993 0.065830455
#> t+4 0.012542669 0.012542669 0.001553634 0.008555788 0.000000000
#> t+5 -0.015737874 -0.018962848 -0.018778023 0.000000000 0.000000000
#> t+6 -0.015737874 -0.018962848 0.000000000 0.000000000 0.000000000
#> t+7 -0.006449948 0.000000000 0.000000000 0.000000000 0.000000000
#> q=2 q=1 q=0
#> t-7 -0.005344254 -0.01423564 -0.03062013
#> t-6 -0.013633666 -0.02711294 -0.04999021
#> t-5 -0.012742334 -0.02650598 -0.04598435
#> t-4 0.015216664 0.01436354 0.02456024
#> t-3 0.073301884 0.08535928 0.12523106
#> t-2 0.144425922 0.16939384 0.23894070
#> t-1 0.202292835 0.24017127 0.40958171
#> t 0.224298035 0.32160407 0.32828097
#> t+1 0.226333286 0.23696256 0.00000000
#> t+2 0.145851628 0.00000000 0.00000000
#> t+3 0.000000000 0.00000000 0.00000000
#> t+4 0.000000000 0.00000000 0.00000000
#> t+5 0.000000000 0.00000000 0.00000000
#> t+6 0.000000000 0.00000000 0.00000000
#> t+7 0.000000000 0.00000000 0.00000000