Skip to contents

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 a matrix or list with 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 rfilters is 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_filters object.

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.016609040 -0.011623676 -0.009152423 -0.016139228
#> t-5 -0.02786378 -0.025914479 -0.022541271 -0.020981640 -0.024948087
#> t-4  0.00000000  0.001157790  0.002918842  0.003566851  0.002620762
#> t-3  0.06549178  0.065858066  0.066006963  0.065743350  0.067817618
#> t-2  0.14735651  0.146931288  0.145468029  0.144292794  0.149387420
#> t-1  0.21433675  0.213120014  0.210044599  0.207957742  0.216072726
#> t    0.24005716  0.238048915  0.233361346  0.230362866  0.241498208
#> t+1  0.21433675  0.211536998  0.205237273  0.201327171  0.215482871
#> t+2  0.14735651  0.143765257  0.135853376  0.131031652  0.148207710
#> t+3  0.06549178  0.061109020  0.051584983  0.045851637  0.000000000
#> t+4  0.00000000 -0.005174272 -0.016310464  0.000000000  0.000000000
#> t+5 -0.02786378 -0.033829557  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.037925830 -0.07371504
#> t-5 -0.035216813 -0.04601336
#> t-4  0.003869912  0.01806602
#> t-3  0.080584644  0.11977342
#> t-2  0.173672322  0.23785375
#> t-1  0.251875504  0.34104960
#> t    0.288818862  0.40298562
#> t+1  0.274321400  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.005536347 -0.003874559 -0.003050808
#> t-6 -0.015737874 -0.015737874 -0.014174506 -0.011388316 -0.010044688
#> t-5 -0.015737874 -0.015737874 -0.013788576 -0.010415368 -0.008855737
#> t-4  0.012542669  0.012542669  0.013700459  0.015461511  0.016109520
#> t-3  0.070949432  0.070949432  0.071315715  0.071464612  0.071200998
#> t-2  0.142395015  0.142395015  0.141969789  0.140506531  0.139331295
#> t-1  0.200583472  0.200583472  0.199366739  0.196291325  0.194204467
#> t    0.222910217  0.222910217  0.220901976  0.216214406  0.213215926
#> t+1  0.200583472  0.200583472  0.197783724  0.191483998  0.187573896
#> t+2  0.142395015  0.142395015  0.138803758  0.130891877  0.133712093
#> t+3  0.070949432  0.070949432  0.066566668  0.054324221  0.066603036
#> t+4  0.012542669  0.012542669  0.001730137  0.009039762  0.000000000
#> t+5 -0.015737874 -0.018962848 -0.018639536  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.005379743 -0.01264194 -0.02457168
#> t-6 -0.013695772 -0.02438088 -0.03990947
#> t-5 -0.012822184 -0.02309091 -0.03388746
#> t-4  0.015163431  0.01641258  0.03060869
#> t-3  0.073275267  0.08604229  0.12523106
#> t-2  0.144425922  0.16871082  0.23289226
#> t-1  0.202319451  0.23812223  0.39446059
#> t    0.224351268  0.31739216  0.31517601
#> t+1  0.226430881  0.23343365  0.00000000
#> t+2  0.145931478  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