On Mon, 11 Jun 2018, Riccardo (Jack) Lucchetti wrote:
On Mon, 11 Jun 2018, Allin Cottrell wrote:
> The filter() function is certainly nice to have, but I can't help thinking
> it's kinda backwards, and hence less intuitive than it could be -- or is it
> just me?
Allow me to establish notation: let's say what you want to generate is
A(L) y_t = B(L) x_t
> This function offers "an ARMA-like filtering of the argument x", but
what's
> naturally interpreted as the MA part comes first and is obligatory while
> the AR part is second and optional.
If I remember correctly, this is a consequence of the fact that the "driver"
series must have some kind of impact on the result, so the MA polynomial B(L)
cannot be empty, and therefore it seems natural that something _has_ to be
there, while the same is not true for the A(L) polynomial (when you want some
kind of moving average).
OK, that rationale had crossed my mind but I didn't give it enough
weight.
For example, using filter() for generating data for an ARDL model is
quite
easy: if you have
y_t = a y_{t-1} + b0 x_t + b1 x_{t-1} + epsilon_t
you just use
series y = filter(epsilon, {b0, b1}, a)
Hmm, doesn't that give you
y_t = a y_{t-1} + b0 epsilon_t + b1 epsilon_{t-1}
> You can of course use it to construct a pure AR series but that
requires
> "pretending" that y is x, so to speak.
well, you could just use "1" for the middle argument, as in
y = filter(u, 1, phi)
for y_t = \phi y_{t-1} + u_t
True. But my "awkward" case was in effect y_t = a y_{t-1} + k, which
would I think require
y = filter(u, 0, a) + k
if one wishes to avoid
y = filter(y, a) + k # "x" = "y"
Not that it's necessary to avoid the latter once one sees that it
works fine.
Anyway, I'm happy to withdraw my objection (if that's what it was).
Filter can certainly do the job once you get your head around it.
Allin