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 [EMAIL PROTECTED] 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
[EMAIL PROTECTED]
--
Tom
[[alternative HTML version deleted]]
__
R-help@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.