[R] arima and xreg
Jose Capco
cliomseerg at kriocoucke.mailexpire.com
Thu Sep 11 10:00:28 CEST 2008
On Sep 11, 6:24 am, David Stoffer <dsstof... at gmail.com> wrote:
> Your model is close, but not correct... there are no t's on the parameters
> and the U's aren't lagged.
>
> You can find an ARMAX example on our "quick fix" page:http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm. The
> example is near the bottom and just above the spectral analysis example, but
> you may want to read the "regression with autocorrelated errors" example
> first to get some background.
>
>
>
Ok. so arima of R can only deal with unlagged inputs (thus xreg has
the latest value in the equation). Your example was an ARX (no moving
averages)
here is the code of yoru example : armax.fit = arima(mort,
order=c(2,0,0), xreg=cbind(trend, part))
I guess I can change it to ARMAX if I use order=c(p,0,q) =)
Now theres one thing that might be worth mentioning here though. The
above can only work (I am guessing) if the input values (the columns
of xreg) are uncorrelated (or what word do use for that, sorry Im a
pure mathematician, not a statistician :p ). What I mean is that the
matrix in which optim of R must be singular (otherwise I think, from
my last try when using two equal valued columns in xreg, arima will
complain that optim returns an infinity value). Is there a way to
check if the xreg matrix have uncorrelated inputs and then just
discard the column until xreg becomes uncorrelated? I'll do a few more
experiment with xreg and report here.. Im doing this because the
documentation (as many of us already know.. ) do not really explain
xreg very well.
Sincerely,
Jose Capco
More information about the R-help
mailing list