微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

statsmodels.tsa._stl.STL“无法从endog确定周期”

如何解决statsmodels.tsa._stl.STL“无法从endog确定周期”

我想被statsmodels STL方法分解

我的时间序列数据如下所示:

         success.rate
Date
2020-09-11  24.735701
2020-09-14  24.616301
2020-09-15  24.695900
2020-09-16  24.467051
2020-09-17  24.118799

当我把它放到 STL 中时

STL(sdf,seasonal=20,robust=True)

我总是收到如下错误

--------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/mnt/d/mywork/test
 STL(sdf,robust=True)
----> 1 STL(sdf,robust=True)

statsmodels/tsa/_stl.pyx in statsmodels.tsa._stl.STL.__init__()

ValueError: Unable to determine period from endog

解决方法

如果您的时间序列在索引上没有已知频率(例如,sdf.index.freqNone,那么您需要使用 period 设置季节性周期。{ {1}} 告诉 STL 在季节性 LOWESS 中使用多少个完整的季节,但不告诉 STL 一个完整时期需要多少个观测值。

seasonal

此代码产生

STL Demonstration

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。