Statsmodels seasonal_decompose - 这有什么天真?
Statsmodels seasonal_decompose - what is naive about it?
一直在 Python 处理时间序列,并使用 sm.tsa.seasonal_decompose
。在 docs 中,他们介绍了这样的功能:
We added a naive seasonal decomposition tool in the same vein as R’s decompose
.
这是文档中的代码及其输出的副本:
import statsmodels.api as sm
dta = sm.datasets.co2.load_pandas().data
# deal with missing values. see issue
dta.co2.interpolate(inplace=True)
res = sm.tsa.seasonal_decompose(dta.co2)
res.plot()
他们说它 幼稚 但没有关于它有什么问题的免责声明。有人知道吗?
我做了一些(aehm...天真的)研究,according to the reference, it seems that StatsModels uses the classic moving average method to detect trends and apply seasonal decomposition (you can check more here, specifically about Moving Average and Classical Decomposition)。
但是,还可以使用其他高级季节性分解技术,例如 STL decomposition, which also has some Python implementations。 (更新 - 11/04/2019 正如@squarespiral 在评论中指出的那样,此类实现似乎已合并到 StatsModels 的主分支中)。
在上面的链接中,您可以找到关于每种建议方法的优缺点的完整参考。
希望对您有所帮助!
一直在 Python 处理时间序列,并使用 sm.tsa.seasonal_decompose
。在 docs 中,他们介绍了这样的功能:
We added a naive seasonal decomposition tool in the same vein as R’s
decompose
.
这是文档中的代码及其输出的副本:
import statsmodels.api as sm
dta = sm.datasets.co2.load_pandas().data
# deal with missing values. see issue
dta.co2.interpolate(inplace=True)
res = sm.tsa.seasonal_decompose(dta.co2)
res.plot()
他们说它 幼稚 但没有关于它有什么问题的免责声明。有人知道吗?
我做了一些(aehm...天真的)研究,according to the reference, it seems that StatsModels uses the classic moving average method to detect trends and apply seasonal decomposition (you can check more here, specifically about Moving Average and Classical Decomposition)。
但是,还可以使用其他高级季节性分解技术,例如 STL decomposition, which also has some Python implementations。 (更新 - 11/04/2019 正如@squarespiral 在评论中指出的那样,此类实现似乎已合并到 StatsModels 的主分支中)。
在上面的链接中,您可以找到关于每种建议方法的优缺点的完整参考。
希望对您有所帮助!