Re: [R] lags and differences

About this list Date view Thread view Subject view Author view Attachment view

From: Prof Brian Ripley (ripley@stats.ox.ac.uk)
Date: Wed 12 May 2004 - 04:47:50 EST


Message-id: <Pine.LNX.4.44.0405111943240.1907-100000@gannet.stats>

Lags apply to time series, and are ignored by lm. You need to do
something like

    dat <- ts.intersect(y1=diff(y), x1, x11 = lag(x1,-1), dframe=TRUE)
    lm(y1 ~ x1 + x11, data=dat)

On Tue, 11 May 2004, fciclone wrote:

> Dear all, could someone please clarify me if this
> works, so as to implement lags and differences for
> example in y and in a independent x1 of a regression?
>
> model<-lm((diff(y), -i)~x1+lag(x1,-1), data=anydata)

And DON'T tag onto an irrelevant post from another thread, as the posting
guide specifically asks you not to!

-- 
Brian D. Ripley,                  ripley@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

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:09 EST