ARIMA模型中model_fit() got an unexpected keyword argument 'disp'
时间: 2023-11-18 21:05:39 浏览: 128
这个错误可能是因为你使用了旧版本的statsmodels库。在旧版本的statsmodels中,ARIMA模型的fit()方法不支持disp参数。但是在新版本的statsmodels中,ARIMA模型的fit()方法支持disp参数。
要解决这个问题,你可以尝试更新statsmodels库到最新版本。你可以使用以下命令来更新:
```
!pip install --upgrade statsmodels
```
如果更新后仍然出现相同的错误,请检查你的代码是否正确地调用了fit()方法,并正确地传递了参数。你可以参考statsmodels文档中的示例来确保正确地使用了fit()方法。
相关问题
TypeError: ARIMA.fit() got an unexpected keyword argument 'disp'
这个错误通常是由于ARIMA模型的fit()方法不支持disp参数导致的。disp参数用于控制拟合过程中是否输出详细信息。如果你想要控制输出信息,可以使用ARIMA模型的summary()方法。以下是一个例子:
```python
from statsmodels.tsa.arima_model import ARIMA
import pandas as pd
# 创建ARIMA模型
model = ARIMA(data, order=(1, 1, 1))
# 拟合模型
model_fit = model.fit(disp=0)
# 输出模型摘要
print(model_fit.summary())
```
如果你仍然想要使用disp参数,你可以尝试使用ARMA模型的fit()方法,因为它支持disp参数。以下是一个例子:
```python
from statsmodels.tsa.arima_model import ARMA
import pandas as pd
# 创建ARMA模型
model = ARMA(data, order=(1, 1))
# 拟合模型
model_fit = model.fit(disp=0)
# 输出模型摘要
print(model_fit.summary())
```
ARIMA.fit() got an unexpected keyword argument 'disp'
The error message suggests that the `ARIMA.fit()` method of the `statsmodels` library does not recognize the `disp` argument. This argument is used to control the amount of output displayed during the fitting process, but it may not be supported by your version of the library.
To fix this error, you can either remove the `disp` argument from the `ARIMA.fit()` method call or upgrade your `statsmodels` library to a version that supports this argument. You can try upgrading the library using the following command in your terminal:
```
pip install statsmodels --upgrade
```
If upgrading the library does not work, you can try removing the `disp` argument and see if the `ARIMA.fit()` method runs without errors.