2

I am trying to figure out how to use the Python port of CausalImpact package.

In the examples notebook, there is a section on working with seasonal data.

It is still unclear to me how to define the nseasons parameter.

In the notebook example:

ci = CausalImpact(season_data, pre_period, post_period, nseasons=[{'period': 7, 'harmonics': 2}, {'period': 30, 'harmonics': 5}])

neasons takes a list of dicts. I believe setting the 'period':7 is used to denote seasonality at a weekly level, and 'period':30 at a monthly level, but I'm not 100% sure. I also do not understand, however, what the harmonics parameter represents.

The dataset I'm working with right now is the daily aggregates of sales for an online retailer. Ultimately, I would like to have the model consider the fact that seasonality can occur at the weekly, monthly, and quarterly level. How can I set the nseasons parameter to do this?

Korean_Of_the_Mountain
  • 1,428
  • 3
  • 16
  • 40

1 Answers1

0

I found some useful parameters when I aggregated my transactional sales data to weekly level and then set these parameters:

nseasons=[{'period':4},{'period':12},{'period': 52}]

because for weekly sales data that span several years, we expected seasonal trends to be observed at month (4 weeks), quarter (12 weeks), and year (52 weeks) levels.

Korean_Of_the_Mountain
  • 1,428
  • 3
  • 16
  • 40