pythontime-seriesstatsmodelsautoregressive-models

Automatically select lags for AutoRegression model statsmodels


In statsmodels v0.10.1 there was no need to choose the number of lags in Autoregressive AR(p) model. If you chose not to specify the number of lags, the model would have chosen the best one for you which was ideal for running the model automatically. In the new version 0.11.1 this model is now called AutoReg, and it seems that the lags are now mandatory. Is there a way to make this model in the new version choose the best number of lags for you?


Solution

  • It is now a standalone function, statsmodels.tsa.ar_model.ar_select_order

    https://www.statsmodels.org/devel/generated/statsmodels.tsa.ar_model.ar_select_order.html?highlight=ar_select