Reputation: 6149
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!
Upvotes: 1
Views: 1972
Reputation: 31
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)
Upvotes: 0
Reputation: 31800
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)
Upvotes: 2