Re: [R] Linear model and time series

From: John C Frain <frainj_at_gmail.com>
Date: Sun 01 Apr 2007 - 16:20:23 GMT

This question is not as simple as might appear. As the data are time series one should be very concerned about the distribution of the residuals, Are the series stationary and if not are they integrated of the same order and cointegrated. The danger of spurious results is a very live issue. As an example the attached data file contains two series. The file cpi.csv contains data on the log of the Irish CPI for the period 1957 Quarter 1 to 2006 Quarter 2. It also contains data on a variable c which has been proposed as an indicator of the level of the CPI. If you complete the regression using lm() you will get an apparently good answer. In effect the variable c is cumulative rainfall in Armagh from 1857 Quarter 1 to 1906 Quarter 2. Despite the favourable regression results there is obviously no relationship between the variables.

Best Regards

John Frain

On 31/03/07, Achim Zeileis <Achim.Zeileis@wu-wien.ac.at> wrote:
> On Sat, 31 Mar 2007, Andre Jung wrote:
>
> > Dear all,
> >
> > I have three timeseries Uts, Vts, Wts. The relation between the time
> > series can be expressed as
> >
> > Uts = x Vts + y Wts + residuals
> >
> > How would I feed this to lm() to evaluate the unknowns x and y?
>
> If the time series are aligned (and univariate) you can just do
> lm(Uts ~ Vts + Wts)
> If not, have a look at the "dynlm" and/or "dyn" packages.
> Z
>
> > Thanks,
> > andre
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch 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.
> >
> >
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>

```--
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:frainj@tcd.ie
mailto:frainj@gmail.com

______________________________________________
R-help@stat.math.ethz.ch 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.
```
Received on Mon Apr 02 02:27:34 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 02 Apr 2007 - 10:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.