Reputation:
I used to forecast sales of computers at a weekly level in SAS, based on broadly two parameters - Pricing and Marketing spends (vehicle level - hence several variables). This was easy in SAS as I could use PROC ARIMA
.
Could you help me to transition to R? I have imported the dataset, performed the auto.arima
and analysed p - values for some variables. However I am unaware as to how to proceed with forecasting, for the next 26 weeks. Any help would be greatly appreciated!
Upvotes: 3
Views: 18078
Reputation: 973
R has a built-in ARIMAX procedure called arima
. To get the X part, use the xreg=
argument. If you don't have exogenous variables and don't use xreg=
, note that the the "Intercept" result may not indicate what you think it indicates.
So if you're using a ARIMAX(1, 2, 3)(1, 0, 0) model with dependent variable sales (monthly data), and an exogenous variable nasdaq (and you have a prediction for nasdaq of nasdaq.pred), you'd do:
model <- arima (sales, order=c(1, 2, 3), seasonal=list (order=c(1, 0, 0), freq=12),
xreg=nasdaq)
pred <- predict (model, newxreg=nasdaq.predict)
Upvotes: 5
Reputation:
Suppose Your ARIMA model is Testing then ot forecast for next 26 weeks is:
Forecastedvalue<-forecast.Arima(Testing, h=26)
Hope this helps
Upvotes: -2