On Mon, 2010-08-23 at 08:12 +0530, Aditya Damani wrote:> Hi,
>
> 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.
require(nlme)
?gls
?corARMA
HTH
G
>
> TIA
> Aditya
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%