Re: [R] time series regression

From: Achim Zeileis <>
Date: Mon 11 Jul 2005 - 19:07:25 EST

On Fri, 8 Jul 2005, yyan liu wrote:

> Hi:
> I have two time series y(t) and x(t). I want to
> regress Y on X. Because Y is a time series and may
> have autocorrelation such as AR(p), so it is not
> efficient to use OLS directly. The model I am trying
> to fit is like
> Y(t)=beta0+beta1*X(t)+rho*Y(t-1)+e(t)
> e(t) is iid normal random error. Anybody know whether
> there is a function in R can fit such models? The
> function can also let me specify how many beta's and
> rho's I can have in the model.

If you want to estimate the model by ML, you can use arima() and specify further regressors via the `xreg' argument. Estimation by OLS can be done via lm(), but that typically requires setting up the lags yourself. More convenient interfaces are provided in the `dyn' package by Gabor Grothendieck and my `dynlm' package. Z

> Thx a lot!
> liu
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!
> mailing list PLEASE do read the posting guide! Received on Mon Jul 11 19:17:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:28 EST