[R] What is the best way to lag a time series?

Liviu Andronic landronimirc at gmail.com
Sun Dec 26 09:21:50 CET 2010


On Sun, Dec 26, 2010 at 8:49 AM, Christian Schoder
<schoc152 at newschool.edu> wrote:
> Dear R-users,
>
> I've been using R for a while and I am very satisfied! Unfortunately, I
> still have not figured out an efficient and general way to construct and
> use lags of time series, especially when I need to work with different
> packages.
>
> Let me give an example. I have two time series x and y and I want to
> estimate a variaty of distributed lags models and run different tests
> (autocorrelation, etc). It is obvious that I need to be able to lag x
> and y in a flexible way. So far, my temporary solution was to construct
> the lags manually (x1,..,xn and y1,..,yn) in a spreadsheet and import it
> to R, which is not very satisfactory because it does not allow for much
> flexibility.
>
> Is there a straighforward command which allows me to easily construct a
> lag
>
Perhaps ?diff.

Liviu


> when required and which allows me to, for example, use the lm()
> command to fit a dynamic model and the bgtest() command to perform the
> breusch-godfrey test on the same model?
>
> Is it adviseable to use time series objects which consist of many time
> series (like a dataframe) or is it better to have it contain only one
> time series?
>
> I would be grateful for any hints and links.
>
> Thx!
> Christian
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail



More information about the R-help mailing list