I think that the dynlm package was designed for just such a problem. I also
would not be surprised if there are tools in the zoo package to do this. You
should probably check out the time series task view on CRAN as well.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of zhijie zhang
> Sent: Thursday, March 05, 2009 8:56 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Does R have function or method to finish my task?
>
> Dear all,
> Does R have function or method to finish the following task.
> Say i have a dataset. The response variable is Y, and the indepedent
> variables are X1, X2, X3, and YEAR. See an example.
> Y X1 X2 X3 X4
> YEAR
> 13.4 2.8 3.5 2.5 1.8 1990
> 10.5 1.8 2.4 2 3 1991
> .... .....
> In ecology, Y may be not only related with X1, X2, X3 in the same year
> as
> Y, but also may be related with X1, X2, X3 and Y in the previous one ,
> two
> or more years as Y. But which year has the closest relationship is not
> know
> and this may be one of the analysis aim.
> Take Year=1995 as an example,
> Y_1995 may be related with
> X1_1995 , X2_1995 , X3_1995,
> X1_1994 , X2_1994 , X3_1994, Y_1994, (previous one year)
> X1_1993 , X2_1993 , X3_1993, Y_1993 (previous two years)
> ... ...
> (previous more years)
> Pay attention to the situation that Y itself may also affect its own
> value
> of the next several years.
> Anybody knows whether R have functions or methods to
> finish the above task.
> I hope i have explained it clearly. Any suggestions or help are
> greatly
> appreciated.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.