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:
library(expsmooth)
data(utility)
n=length(utility)
y=ts(log(utility[1:(n-28*24)]),f=24)
new.data=ts(log(utility[(n-28*24+1):n]))
library(forecast)
model = auto.arima(y)
newfit <- Arima(new.data, model=model)
onestep.for <- fitted(newfit)