1
$\begingroup$
theDate <- as.Date(end.date)
forec <- NULL
while (as.Date(theDate) < as.Date(end.date2)){
  data <- tsales[paste(start.date,theDate,sep="::")]
  fit <- auto.arima(data,xreg=na.omit(xreg[paste(start.date,theDate,sep="::")])*1)
  fc <- forecast(fit, h=1,xreg=(xreg[theDate])*1)$mean
  forec <- c(forec,fc)
  theDate <- as.Date(theDate) + 1
}

start.date/end.date are the start/end dates of my training period end.date2 is the end date of my test period.

I was wondering about this 2 outputs:

forec:
2015-01-13 2015-01-14 2015-01-15 2015-01-16 2015-01-17 
1034.266   1316.889   1250.597   1282.745   2875.170 

testsales:
2015-01-15 1268
2015-01-16 1208
2015-01-17 2856

Why does forec starts at 01/13 ? Does it need a period to start forecasting?

thank you

$\endgroup$
2
  • 1
    $\begingroup$ You would need to look at model summary to find out the order of your arima. It will skip that many observations before first forecast. $\endgroup$
    – Arun Jose
    Commented Oct 27, 2016 at 19:12
  • $\begingroup$ @ArunJose Put this as an answer and I'll close the topic :) $\endgroup$ Commented Nov 15, 2016 at 11:09

1 Answer 1

1
$\begingroup$

Arima will skip records depending on the order of your model. Please check your model summary to get info about this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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