views:

384

answers:

2

Hi

I have a stationary time series to which I want to fit a linear model with an autoregressive term to correct for serial correlation, i.e. using the formula At = c1*Bt + c2*Ct + ut, where ut = r*ut-1 + et

(ut is an AR(1) term to correct for serial correlation in the error terms)

Does anyone know what to use in R to model this?

Thanks Karl

A: 

What is your link function?

The way you describe it sounds like a basic linear regression with autocorrelated errors. In that case, one option is to use lm to get a consistent estimate of your coefficients and use Newey-West HAC standard errors.

I'm not sure the best answer for GLM more generally.

Tristan
+4  A: 

The GLMMarp package will fit these models. If you just want a linear model with Gaussian errors, you can do it with the arima() function where the covariates are specified via the xreg argument.

Rob Hyndman