Re: [R] question about xreg of arima

From: tom soyer <tom.soyer_at_gmail.com>
Date: Sun, 13 Jan 2008 08:12:59 -0600

Thanks Richard. I am just trying to understand exactly what is R's arima doing, and I am having a hard time. It seems that xreg is necessary to force arima to include the constant term, but it appears that exactly how this is done is not documented. If a series is not differenced, e.g. AR(1), then does one still need to include xreg? If I take an AR(1) series with known coefficient and use arima to do the fit using arima, i.e., arima(x = ar1, order = c(1, 0, 0)), the estimated coefficient is not as good as a simple lm fit using a one period lag. I am wondering if this should be the expected result? Then, I tried Robert Shumway's sarima, and it gave me a much better coefficient compared to arima (but still a little bit worse than lm). I don't understand why this is happening. I guess I am even more confused...

On 1/12/08, Richard Saba <sabaric_at_charter.net> wrote:
>
> Tom
>
> A constant term is not included in the model if any differencing is
> specified. The xreg= parameter is used to add other explanatory variables to
> the model. In your case xreg=1:length(x) adds a vector of 1's to the model.
> Robert Shumway and David Stoffer's website for their "Time Series Analysis
> an its Applications with R Examples" text has several very helpful documents
> posted on the site (http://www.stat.pitt.edu/stoffer/tsa2/index.html)
> specific to time series analysis. The R ISSUES document address your
> question.
>
>
>
> Richard
>
>
>
> >Hi,
>
> >I am trying to understand exactly what xreg does in arima. The
> documentation for xreg says:"xreg Optionally, a vector or matrix of external
> regressors, which must have >the same number of rows as x." What does this
> mean with regard to the action of xreg in arima?
>
>
>
>
>
> >Apparently somehow xreg made the following two arima fit equivalent in R:
>
>
> >arima(x, order=c(1,1,1), xreg=1:length(x))
>
> >is the same as
>
> > arima(diff(x), order=c(1,0,1))
>
> >While I understand the latter fit (I think), I am puzzled with regard to
> the former. Does anyone know what the former is doing to arima, and why it
> works as it does?
>
> >Thanks!
>
> --
>
> >Tom
>
>
>
> Richard Saba
>
> Department of Economics
>
> Auburn University
>
> Auburn, AL 36849 USA
>
> sabaric_at_auburn.edu
>
>
>
>
>

-- 
Tom

	[[alternative HTML version deleted]]

______________________________________________
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.
Received on Sun 13 Jan 2008 - 14:21:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 Jan 2008 - 14:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive