【问题标题】:Why ImportError: cannot import name 'AutoReg' from 'statsmodels.tsa.ar_model' occuring?为什么 ImportError: cannot import name 'AutoReg' from 'statsmodels.tsa.ar_model' 发生?
【发布时间】:2020-06-07 16:22:10
【问题描述】:

我正在尝试通过从 statsmodels.tsa.ar_model import AutoReg, ar_select_order 导入模块来使用 AR(p) 进行 MLE 回归,但此 ImportError 不断出现。如何解决这个问题?有没有其他方法可以在 Python 中进行自回归?

【问题讨论】:

    标签: python time-series statsmodels mle vector-auto-regression


    【解决方案1】:

    AutoReg 是之前 AR 模型的更新版本,它仅在版本 >= 0.11.1 的 statsmodels 中可用。您可以检查您的 statsmodels 版本。如果它更低,你可以这样做

    pip install statsmodels --upgrade
    

    【讨论】:

    • 升级后我仍然收到帖子中描述的错误。对于为什么会发生这种情况,您还有其他想法吗?
    • 升级 statsmodels 包后,重新启动我正在工作的 Python 环境对我的情况有所帮助。
    【解决方案2】:

    执行pip install statsmodels --upgrade 并重新启动环境。

    【讨论】:

      猜你喜欢
      • 2022-12-21
      • 2019-07-20
      • 2020-07-16
      • 2019-06-10
      • 2014-09-25
      • 2014-01-02
      • 1970-01-01
      • 1970-01-01
      • 2022-11-09
      相关资源
      最近更新 更多