[R] forecast & xreg

From: Vorlow Constantinos <CVorlow_at_eurobank.gr>
Date: Tue, 08 Jul 2008 13:36:28 +0300


Dear all,  

I am fitting an arimax (arima with some extra explanatory variables) model to a time series. Say, I have a Y (dependent variable) and an X (explanatory).

Y is 100 observations (time series) and X is 100 + 20 (20 to use for the forecast horizon).  

I can not make xreg work with the forecast function for an arima fit.

The "predict" function seems to be working but the "forecast" returns  

> Error in predict.Arima(object, n.ahead = h) : 'xreg' and 'newxreg'
have different numbers of columns...  

Xreg is a time series of explanatory variables of the same length of the dependent and newxreg should be as long as the forecast horizon (same number of explanatory variables). Is this right?  

Or should xreg be: X[1:100] and newxreg X[101:20], i.e. use different segments of the same regressor ???  

In other words, can/should newxreg and xreg be different variables as long as their lengths are according to the forecast horizon specs? This doesn't seem to work...  

Any scripts/demos would be extremely welcome.  

Thanks,

COstas

P Think before you print.

Disclaimer:
This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system. EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication. EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.

        [[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 Tue 08 Jul 2008 - 10:43:41 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 Tue 08 Jul 2008 - 11:31:09 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