Fitting a regression model with with ARMA error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fitting a regression model with with ARMA error

Aditya Damani
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?

TIA
Aditya

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Fitting a regression model with with ARMA error

Gavin Simpson
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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[hidden email] 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.