季节性分解

Seasonal Decomposition

当我使用来自 statsmodels 的季节性分解方法分解时间序列时,我遇到了建模数据 head/tail 中缺少值的问题。

这是由于季节性方法默认采用对称移动平均法。

    statsmodels.tsa.seasonal.seasonal_decompose(x, model='additive', filt=None, freq=None, two_sided=True, extrapolate_trend=0)

为了解决这个问题,我必须通过一个过滤器,但到目前为止我还不知道是哪一个。

谁能帮帮我?在我的数据末尾至少有值对我来说很重要。

阅读the statsmodels documentation

two_sided: The moving average method used in filtering. If True (default), a centered moving average is computed using the filt. If False, the filter coefficients are for past values only.

"If False, the filter coefficients are for past values only":所以看起来如果你愿意切换到单边过滤器,你会在数据末尾获得所有值,你说这是必不可少的。