Re: [S] How do I invoke the second degree lag operator? y(t) + .6y(t-2)

Paul Gilbert (
Thu, 12 Nov 1998 10:42:57 -0500


The function "lag" has an optional parameter k with default =1. To shift 2 use
k=2 (or -2) depending on which way you want to shift. Beware that this may not
work the way you expect, so you might want to do some testing.

In general time series calculations like this tend to be very slow in S,
especially if you have long series or multivariate problems. (Sometimes you can
use some trick for avoiding the iterative nature of the calculation.) You might
want to look at my time series library, available at
<>. For simple problems this may be a
lot more than you want. There is documentation at that web site, so you can get
some idea if it does what you want before you install it. In the library the
core code for the iteration is done in Fortran which is called from S. This
typically speeds up calculations by about 1000 times or more.

Paul Gilbert

This message was distributed by To unsubscribe
send e-mail to with the BODY of the
message: unsubscribe s-news