Solved – Seasonally adjusted month-to-month growth with underlying weekly seasonality

forecastingrseasonalitytime series

As a side hobby, I have been exploring forecasting time series (in particular, using R).

For my data, I have the number of visits per day, for every day going back almost 4 years. In this data there are some distinct patterns:

  1. Monday-Fri has a lot of visits (highest on Mon/Tue), but drastically less on Sat-Sun.
  2. Certain times of the year drop (i.e. many less visits around U.S. Holidays, summers show less growth)
  3. Significant growth year-to-year

It would be nice to be able to forecast an upcoming year with this data, and also use it to have seasonally adjusted month-to-month growth. The main thing that throws me off with a monthly view is:

  • Certain months will have more Mon/Tue than other months (and that isn't consistent over years either). Therefore a month that happens to more weekdays needs to be adjusted accordingly.

Exploring weeks also seems difficult since the week numbering systems change from 52-53 depending on the year, and it seems ts doesn't handle that.

I'm pondering taking an average for the weekdays of the month, but the resulting unit is a bit strange (Growth in Avg. Weekday Visits) and that would be dropping data which is valid.

I feel this sort of data would be common in time series, (say for example electricity usage in office building might be something like this), anyone have any advice on how to model it, in particular, in R?

The data I am working with is pretty straight forward, it starts like:

            [,1]
2008-10-05 17607
2008-10-06 36368
2008-10-07 40250
2008-10-08 39631
2008-10-09 40870
2008-10-10 35706
2008-10-11 18245
2008-10-12 23528
2008-10-13 48077
2008-10-14 48500
2008-10-15 49017
2008-10-16 50733
2008-10-17 46909
2008-10-18 22467

and continues like this up to the present, with an overall trend of growth, some dips around US holiday weeks, and growth generally slowing during the summer.

Best Answer

I model thus kind of data all the time. You need to incorporate

  • day-of-the-week
  • holiday effects ( lead , contemporaneous and lag effects )
  • special days-of-the-month
  • perhaps Friday before a holiday or a Monday after a holiday
  • weekly effects
  • monthly effects
  • ARIMA structure to render the errors white noise;
  • et.al. .

The statistical approach is called Transfer Function Modelling with Intervention DEtection. If you want to share your data either privately via dave@autobox.com or preferably via SE , I would be more than glad to actually show you the specifics of a final model and further your ability to do it yourself or at least to help you and others to understand what needs to be done and what can be done. In either case you come out smarter without spending any treasure be it coin or time.You might read some of my other responses to time series questions to learn more.

Related Question