[R] time series regression

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Mon Jul 11 11:07:25 CEST 2005


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
>
> ______________________________________________
> R-help at 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
>




More information about the R-help mailing list