Question

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!

Was it helpful?

Solution

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)

OTHER TIPS

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top