Traceback (most recent call last): File "F:\pythonproject\ARIMA-GRACH\3.py", line 26, in <module> arima_model = ARIMA(train_data, order=(10, 1, 0)) File "E:\anaconda\lib\site-packages\statsmodels\tsa\arima_model.py", line 45, in __init__ super().__init__(*args, **kwargs) File "E:\anaconda\lib\site-packages\statsmodels\tsa\arima_model.py", line 29, in __init__ raise NotImplementedError(ARIMA_DEPRECATION_ERROR) NotImplementedError: statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the . between arima and model) and statsmodels.tsa.SARIMAX. statsmodels.tsa.arima.model.ARIMA makes use of the statespace framework and is both well tested and maintained. It also offers alternative specialized parameter estimators.
时间: 2023-12-04 12:05:03 浏览: 38
这个错误是因为你使用了一个已经被弃用的 statsmodels.tsa.arima_model.ARIMA 模型,应该使用新的 statsmodels.tsa.arima.model.ARIMA 模型。你需要更新你的代码来使用新的模型。
具体来说,你需要从 statsmodels.tsa.arima.model 导入 ARIMA,然后创建一个 ARIMA 模型对象,指定 order 参数。示例代码如下:
```python
from statsmodels.tsa.arima.model import ARIMA
arima_model = ARIMA(train_data, order=(10, 1, 0))
```
这应该可以解决你的问题。
相关问题
Traceback (most recent call last): File "F:\pythonproject\ARIMA-GRACH\5.py", line 22, in <module> best_param = pdq[aic.index(min(aic))] ValueError: min() arg is an empty sequence
这个错误通常是由于没有找到最小值导致的。具体来说,在这里的问题可能是 `aic` 列表为空,因此无法找到最小值。这可能是因为代码中的某些参数设置不正确或数据不完整。
您可以尝试检查是否已正确设置所有参数,并确保数据集中有足够的数据点。您还可以尝试使用 `print` 语句打印变量,以便查看它们的值是否正确。如果以上方法都没有解决问题,请提供更多的代码和数据信息,以便我可以更好地帮助您解决问题。
Traceback (most recent call last): File "F:\pythonproject\ARIMA-GRACH\3.py", line 27, in <module> arima_result = arima_model.fit(disp=False) File "E:\anaconda\lib\site-packages\statsmodels\base\wrapper.py", line 34, in __getattribute__ obj = getattr(results, attr) AttributeError: 'ARIMAResults' object has no attribute 'fit'
这个错误提示表明你在一个`ARIMAResults`对象上调用了`fit()`方法,但是`ARIMAResults`类并没有该方法。`ARIMAResults`对象是通过对`ARIMA`模型进行拟合后生成的结果对象,而拟合过程实际上是在`ARIMA`模型对象上进行的。因此,你需要使用`ARIMA`对象的`fit()`方法来拟合模型,而不是在`ARIMAResults`对象上调用该方法。