使用ARIMA模块代替ARMA模块
ARMA模块已成为过时模块,因此建议使用ARIMA模块代替。下面是一个示例代码:
import numpy as np
import pandas as pd
from statsmodels.tsa.arima_model import ARIMA
# 创建一个样本时间序列
data = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
# 定义ARIMA模型
model = ARIMA(data, order=(2, 0, 0))
# 拟合模型
model_fit = model.fit(disp=False)
# 预测下一个值
predictions = model_fit.predict(len(data), len(data), typ='levels')
print(predictions)
此代码使用ARIMA模块来拟合时间序列模型并预测下一个值。