(PR#5017) [Rd] ts package function filter: mismatch between
function action and help
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Nov 10 09:12:29 MET 2003
The documentation is what is intended to happen (for compatibility with
S), so the code is wrong. I've altered the code for R 1.8.1.
On Mon, 10 Nov 2003 alistair at statsresearch.co.nz wrote:
> 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
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list