1

I'm trying to use dshw() to deal with double seasonality -- in my case, daily data with one-week (7-day) and one-year (365-day) seasonality. However, I get the following error when I run my code:

data<-msts(1:1000, seasonal.periods=c(7,365), ts.frequency=365, start=2012)
decompose<-dshw(data, period1=7, period2=365)
 -- Error in dshw(data, period1 = 7, period2 = 365) : Seasonal periods are not nested

What do you think is the best practice to get around this issue? Should I just use stl twice on my data (for 7 and 365 day frequencies)? Or modify the data in some way?

Thanks!

Bryan
  • 5,999
  • 9
  • 29
  • 50

2 Answers2

2

Try the tbats() model instead. It was specifically designed to avoid this problem. DSHW is a special case of a TBATS model.

decompose <- tbats(data)
Rob Hyndman
  • 30,301
  • 7
  • 73
  • 85
  • Thanks. I'm using tbats, but am having a similar issue to this CrossValidate post -- http://stats.stackexchange.com/questions/55716/interpreting-time-series-decomposition-using-tbats-from-r-forecast-package -- how do I interpret the slope and level series produced by the decomposition? – Bryan May 21 '13 at 13:41
  • Thanks. So, to combine them for forecasting, can I think of slope like "trend" in an stl decomposition? – Bryan Jun 03 '13 at 00:32
  • Also, I don't see tbats as an option in hierarchical forecasting package `hts` -- any thoughts on how to incorporate it for one of the time series in a hierarchy? – Bryan Jun 03 '13 at 01:16
  • Please spend some time reading the package documentation provided. Use the combinef function to combine ANY forecasts. – Rob Hyndman Jun 03 '13 at 01:57
  • Thanks -- I'll test out tbats and combinef. – Bryan Jun 04 '13 at 16:47
0

If you define period2 in terms of period1 then you won't get the error.

Instead of:

decompose<-dshw(data, period1=7, period2=365)

use:

decompose<-dshw(data, period1=7, period2=7*52)