wwrechard/pydlm

How to set biweekly frequency in seasonal parameter?

Opened this issue · 2 comments

Hi.

I want to fit a time serie with biweekly frequency.

I'm wondering if there's a way to set the biweekly frequency in seasonal parameter.

I know that for daily data, frequency = 7, monthly = 12, quarterly = 4...but I can't figure out how to set biweekly data...maybe 52 / 2 = 26 ???

Thanks a lot.

Hi Alex,

This depends on the granularity of your data. Following is based on the assumption that the time series is daily.

Then bi-weekly frequency should be 14 if you assume weekdays are different (i.e, Monday is different from Tuesday). seasonality(period=14). An example for this would be

Week 1: 1, 2, 3, 4, 5, 6, 7
Week 2: 8, 7, 6, 5, 4, 3, 2
Week 3: 1, 2, 3, 4, 5, 6, 7
...

If you assume there is no difference among weekdays (i.e., Monday is the same as Tuesday), then you should consider using longSeason longSeason(period=2, stay=7, ...). An example for this would be

Week 1: 1, 1, 1, 1, 1, 1, 1
Week 2: 2, 2, 2, 2, 2, 2, 2
Week 3: 1, 1, 1, 1, 1, 1, 1
...

For monthly frequency, it depends on what you mean by "monthly". If you mean the first day of each month should be the same, then you should use seaonality(period=30) or seaonality(period=31) depending on your belief of the month length... If you mean January this year should be the same as the January of next year, then you should use longSeason(period=12, stay=30) or longSeason(period=12, stay=31)

Likewise for quarterly, depending on the actual meaning you want, you might choose either seasonality(period=90) or longSeason(period=4, stay=90).

Thanks