【发布时间】:2019-11-15 05:06:46
【问题描述】:
我正在尝试为我的时间序列数据创建一个 ARIMA 模型。我可以对我的代码做些什么以使其顺利运行?
我正在使用 statsmodels 在 python 中创建 ARIMA 模型,但我收到错误警告
indexedDataset_logscale.head(10)
OUTPUT:
Price
Period
2013-02-08 2.515274
2013-02-11 2.526528
2013-02-12 2.520113
2013-02-13 2.515274
2013-02-14 2.543961
2013-02-15 2.544040
2013-02-19 2.530119
2013-02-20 2.516082
2013-02-21 2.508786
2013-02-22 2.5273
#AR Model
from statsmodels.tsa.arima_model import ARIMA
model = ARIMA(indexedDataset_logscale, order=(0, 1, 2))
results_AR = model.fit(disp = -1)
plt.plot(datasetLogDiffShifting)
plt.plot(results_AR.fittedvalues, color = 'red')
plt.title('RSS: %.4f' %sum((results_AR.fittedvalues-datasetLogDiffShifting['Price'])**2))
print('Plotting AR Model')
Error messages i get are:
"ValueWarning:已提供日期索引,但它没有关联的频率信息,因此在例如 预测。忽略时,例如预测。',ValueWarning)
8 plt.title('RSS: %.4f' %sum((results_AR.fittedvalues-datasetLogDiffShifting['Price'])**2)) TypeError: 'str' 对象不可调用
【问题讨论】:
标签: python pandas statsmodels