网格搜索在python statsmodels中自动选择SARIMAX订单模型

时间:2016-10-10 09:28:42

标签: python time-series statsmodels

我目前正在编写一个函数来对SARIMAX模型的顺序进行网格搜索:(p,q,d)X(P,Q,D,s)。但是,在安装时,我通常会在statsmodels.tsa.SARIMAX()上使用默认设置获得以下类型的错误:

ValueError: Non-stationary starting autoregressive parameters found with `enforce_stationarity` set to True.

ValueError: non-invertible starting MA parameters found with `enforce_invertibility` set to True.

我可以停止强制平稳性和可逆性以停止获取这些错误,但据我所知,我不希望模型参数创建一个不可逆的模型。

放松enforce_stationarity和enforce_invertibility参数是否可以,否则会导致模型不佳?

1 个答案:

答案 0 :(得分:2)

这是我在执行网格搜索的for - 循环中所做的:

for ...:
    try:
        model = smt.SARIMAX(...)
        result = model.fit()
        ...
    except:
        continue

这样,您将跳过非固定或不可逆模型。