简体   繁体   English

CausalImpact:定义季节性数据参数

[英]CausalImpact: defining seasonal data parameters

I am trying to figure out how to use the Python port of CausalImpact package.我想弄清楚如何使用 CausalImpact package 的Python端口。

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.我仍然不清楚如何定义nseasons参数。

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. neasons需要一个字典列表。 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.我相信设置'period':7用于表示每周水平的季节性,而'period':30用于表示每月水平,但我不是 100% 确定。 I also do not understand, however, what the harmonics parameter represents.但是,我也不明白harmonics参数代表什么。

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.最终,我想让 model 考虑到季节性可能发生在每周、每月和每季度级别的事实。 How can I set the nseasons parameter to do this?如何设置nseasons参数来执行此操作?

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.因为对于跨越数年的每周销售数据,我们预计将在月(4 周)、季度(12 周)和年(52 周)级别观察到季节性趋势。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM