Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I want to make forecast on my data by running an arimax model. The data is like:

Value1, Flag1, Flag2, ................., FlagN    
Value2, Flag1, Flag2, ................., FlagN    
Value3, Flag1, Flag2, ................., FlagN    
Value4, Flag1, Flag2, ................., FlagN    
Value5, Flag1, Flag2, ................., FlagN    
....    
ValueM, Flag1, Flag2, ................., FlagN

So, when I want to make a new forecast, I will provide flag values to the model, then it can give me the forecast value?

How can I prepare the input data? What is the proper R function and proper way of calling?

share|improve this question
add comment

1 Answer 1

You want the arima function in base R, or the Arima function in the forecast package. auto.arima may be useful as well.

type ?arima into R to read the help page, which gives a good overview for fitting such models. You'll want to split your data into 2 parts: a vector of class ts for "value," and a matrix of your external regressors, which you pass to the xreg argument of the various arima functions.

You can then predict these models using the predict function. You will need to make forecasts of your xregs and pass them to the prediction function in the newxreg argument. You can also use the forecast function in the forecast package to produce confidence intervals and plots. ?predict.Arima in base R and ?forecast.Arima in forecast.

Before you do any of this; however, you need to think about your forecasting problem. Say you want to forecast 1 step ahead (for ValueN). Will you have the flags for ValueN at time M? If not, your ARIMAX model will be useless.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.