Dear R-help-archive.. I am trying to figure out how to make arima prediction when I have a process involving multivariate time series input, and one output time series (output is to be predicted) .. (thus strictly speaking its an ARMAX process). I know that the arima function of R was not designed to handle multivariate analysis (there is dse but it doesnt handle arma multivariate analysis, only simulations). But there is this beautiful "xreg" as parameter for arima and I was wondering.. for the case of one output series I can actually "trick" R in doing multivariate time series for me no?.. because I saw in the documentation, xreg can be inputed as a ---matrix--- with output.len (length of output data) number of rows.. So in fact I can let the different columns of xreg to actually be the different input time series I need! Is anyone familiar in how arima with xreg as given estimate models? .. how is the model assumed? supposing I write : arima(y, xreg=U, order=c(3,0,2)) how is y_t calculated? (supposing U has 2 columns, with U[1] being first column and U[2] second column) is it y_t = theta_(t-1)y_t-1 + .... + theta_t-3 y_t-3 + intercept + U[1]_t + psi[1]_t-1 U[1]_t-1 + psi[1]_t-2 U[1]_t-2 + ....+ psi[2]U[2]_t-2 + e_t + phi_t-1 e_t-1 + phi_t-2 e_t-2 ?? e_t .. etc. are the white noise series of the model. the documentation is totally vague when it comes to xreg. I hope it is like above :) Would appreciate any remarks or comments. Thanks in advance. Sincerely, Jose
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. Jose Capco wrote:> > Dear R-help-archive.. > > I am trying to figure out how to make arima prediction when I have a > process involving multivariate time series input, and one output time > series (output is to be predicted) .. (thus strictly speaking its an > ARMAX process). I know that the arima function of R was not designed > to handle multivariate analysis (there is dse but it doesnt handle > arma multivariate analysis, only simulations). But there is this > beautiful "xreg" as parameter for arima and I was wondering.. > for the case of one output series I can actually "trick" R in doing > multivariate time series for me no?.. because I saw in the > documentation, xreg can be inputed as a ---matrix--- with output.len > (length of output data) number of rows.. So in fact I can let the > different columns of xreg to actually be the different input time > series I need! > > Is anyone familiar in how arima with xreg as given estimate models? .. > how is the model assumed? > > supposing I write : > > arima(y, xreg=U, order=c(3,0,2)) > > how is y_t calculated? (supposing U has 2 columns, with U[1] being > first column and U[2] second column) > > is it > > y_t = theta_(t-1)y_t-1 + .... + theta_t-3 y_t-3 + intercept + U[1]_t + > psi[1]_t-1 U[1]_t-1 + psi[1]_t-2 U[1]_t-2 + ....+ psi[2]U[2]_t-2 + > e_t + phi_t-1 e_t-1 + phi_t-2 e_t-2 > > ?? > > e_t .. etc. are the white noise series of the model. > > the documentation is totally vague when it comes to xreg. I hope it is > like above :) > > Would appreciate any remarks or comments. Thanks in advance. > > Sincerely, > Jose > > ______________________________________________ > 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. > >----- The power of accurate observation is commonly called cynicism by those who have not got it. George Bernard Shaw -- View this message in context: http://www.nabble.com/arima-and-xreg-tp19415386p19427576.html Sent from the R help mailing list archive at Nabble.com.
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