Re: Fitting a regression model with with ARMA error
On Mon, 2010-08-23 at 08:12 +0530, Aditya Damani wrote:
> I want to fit a regression model with one independent variable. The error
> part should be fitted an ARMA process.
> For example,
> y_t = a + b*x_t + e_t where e_t is modelled as an ARMA process.
> Please let me know how do I do this in R. What code should I use?
See recommended package nlme and its function gls() which fits
generalised least squares regression models. You can supply a
correlation argument to gls() specifying an ARMA process via the
function corARMA(form = ~ FOO) where FOO is a time variable say. The
correlation structure may be nested within another variable. See ?gls
for an example using AR(1) errors. gls() will estimate the parameters of
both the ARMA structure and the regression model.