[R] AR in R

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 18 12:31:25 CEST 2003


On Wed, 16 Jul 2003, John Fox wrote:

> Dear Steve,
> 
> At 11:45 AM 7/16/2003 -0700, CHRISS Steve wrote:
> >R Help,
> >How does one do a least squares regression with an AR component (for any
> >order) in R?
> >
> >Thanks,
> >Steve Chriss
> 
> Do you mean a model with AR errors? If so, you can use the gls (generalized 
> least squares) function in the nlme package. Some details and an example 
> with AR(2) errors are in 
> <http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/appendix-timeseries-regression.pdf>.

You can also use the function arima() in R itself, and that is sometimes
more flexible.

Examples of both are in Venables & Ripley's MASS (2002).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list