[Rd] ts package function filter: mismatch between function action and help (PR#5017)

alistair at statsresearch.co.nz alistair at statsresearch.co.nz
Mon Nov 10 08:27:07 MET 2003


Dear people,

I'm running
RedHat 9.0
and
R : Version 1.7.1  (2003-06-16)

from the help file

# Usage:
#
#     filter(x, filter, method = c("convolution", "recursive"),
#            sides = 2, circular = FALSE, init)

#    init: for recursive filters only. Specifies the initial values of
#          the time series just prior to the start value, in reverse
#          time order. The default is a set of zeros.

but looks as if it should be in usual order as x is e.g.

init  y_0 y_-1 y_-2: 3, 2, 1
filter f_1 f_2 f_3: 1, .5, .25
x: 4, 5, 6, 7, 8

y_1 = 4 + 1*3 + .5*2 + .25*1 = 8.25
y_2 = 5 + 1*8.25 + .5*3 + .25*2 = 15.25
...

but

 > filter(4:8,c(1,.5,.25),method="recursive", init=3:1)
Time Series:
Start = 1
End = 5
Frequency = 1
[1]  6.7500 12.7500 22.3750 37.4375 59.8125

whereas

 > filter(4:8,c(1,.5,.25),method="recursive", init=1:3)
Time Series:
Start = 1
End = 5
Frequency = 1
[1]  8.2500 15.2500 26.1250 42.8125 67.6875

Look forward to your response
thanks
Alistair
-- 
Alistair Gray                       Email:  alistair at statsresearch.co.nz
Statistics Research Associates Ltd  Web:    www.statsresearch.co.nz
PO Box 12 649, Thorndon, Wellington Phone:  +64 +4 972 6531
NEW ZEALAND                         Mobile: +64 +21 610 569



More information about the R-devel mailing list