In this post it was asked how to do one step ahead forecasts using Arima form the forecast package. Now I'm using an example with hourly seasonal data and would like to do something similar but the forecast will be 24 hours ahead. When I get new 24 hours of data I will add them up and produce another 24h forecast. Again without re-estimating the model.

I'm not sure whether the following code is right since the fitted values are theoretically only for the next hour but not for the next 24 hours:


model = auto.arima(y)
newfit <- Arima(new.data, model=model)
onestep.for <- fitted(newfit)

1 Answer 1


As you point out, fitted values are one-step forecasts, whereas you seem to want forecasts from 1 to 24 steps ahead. So you can use

forecast(newfit, h=24)
  • $\begingroup$ Many thanks I will use a loop that updates newfit and forecast(newfit, h=24)then $\endgroup$
    – nopeva
    Commented Apr 13, 2013 at 12:30

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.