# R forecasting, flat forecast

I’m trying to produce a hourly, daily forecast for revenue in R. I set seasonal periods to 24, for 24 hours, and 365.25 for days in a year. I attached the fit vs actual plot and the forecast produced by R.

I then fit the time series with the tbats model due to the high seasonal periods. I then try and forecast 8112 periods or just under 1 year.

My problem is that I keep getting a flat model\$mean. However, the fitted vs actuals looks like its catching the seasonality.

rev_ts       <- msts(revenue_data, seasonal.periods=c(24,365.25))
rev_fit      <- tbats(rev_ts)
rev_forecast <- forecast(rev_fit,h=8112)
plot(rev_forecast )


UPDATE:

Trying to reference your write-up here Rob:

http://robjhyndman.com/hyndsight/longseasonality/

So m=365.25? And n= # of observations? Sorry I'm a current student and new to R (and modeling for that matter). Where does this take into account hourly seasonality

Trying to implement your code from post using these lines of code:

m=365.25 (Where does this take into account hourly seasonality)

n= 25656 (number of observations, historical data)

rev_fit <- Arima(rev_ts, order=c(2,0,1), xreg=fourier(1:n,4,m))

plot(forecast(rev_fit, h=2*m, xreg=fourier(n+1:(2*m),4,m)))

Any explanation on the theory and what this is actually doing? Sorry for all the questions, but I'd love to understand this more fully.

Thanks!