Hi to all, In other statistical software, such as Eviews, it is possible to regress a model with the Least Squares method, assuming that the residuals follow an AR(q) process. For example the resulting regression is something like y = 1.2154 + 0.2215 x + 0.251 AR(1) How is it possible to do the same in R? Thank you very much in advance, Constantine Tsardounis http://www.costis.name
?gls On Feb 16, 2009, at 12:28 PM, constantine wrote:> In other statistical software, such as Eviews, it is possible to > regress a model with the Least Squares method, assuming that the > residuals follow an AR(q) process. > For example the resulting regression is something like > > y = 1.2154 + 0.2215 x + 0.251 AR(1) > > How is it possible to do the same in R?
You will need library(nlme) first. But not for ?arima, which seems the more obvious way to do this simple example. On Mon, 16 Feb 2009, Michael Kubovy wrote:> ?gls > > On Feb 16, 2009, at 12:28 PM, constantine wrote: > >> In other statistical software, such as Eviews, it is possible to >> regress a model with the Least Squares method, assuming that the >> residuals follow an AR(q) process. >> For example the resulting regression is something like >> >> y = 1.2154 + 0.2215 x + 0.251 AR(1) >> >> How is it possible to do the same in R? > > ______________________________________________ > 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. >-- 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
Thank you for the lightening replies. I tested various corStruct objects (?corClasses) using the nlme package and all work flawlessly. My best regards to all... Constantine Tsardounis
Thank you Gabor Grothendieck for your message. I would surely like to say, that if someone wants to assume AR(1) residuals, running the regression y ~ x, could run gls(y~x, correlation = corAR1(0, ~1)) Constantine Tsardounis http://www.costis.name