Python 利用ARIMA进行预测

Python 利用ARIMA进行预测,python,forecasting,arima,Python,Forecasting,Arima,所以我一直在尝试预测我在网上找到的流量数据。我有以下数据帧。我这样做是为了使数据是平稳的,我用所有的数据预测了预测 这是创建绘图并拟合数据的代码,我给出了下图。(不太确定年份是否在底部,但它是年份中的一个 然后我想预测30年后的情况。我使用下面的代码预测未来30年。它从数据帧中的最后一个数据点到“未来”的30个数据点 然而,我得到了下面的图表,考虑到数据中有一个积极的趋势,它并没有真正正确地预测它 有什么线索我错在哪里或者我需要补充什么吗?干杯 from statsmodels.tsa.a

所以我一直在尝试预测我在网上找到的流量数据。我有以下数据帧。我这样做是为了使数据是平稳的,我用所有的数据预测了预测

这是创建绘图并拟合数据的代码,我给出了下图。(不太确定年份是否在底部,但它是年份中的一个

然后我想预测30年后的情况。我使用下面的代码预测未来30年。它从数据帧中的最后一个数据点到“未来”的30个数据点

然而,我得到了下面的图表,考虑到数据中有一个积极的趋势,它并没有真正正确地预测它

有什么线索我错在哪里或者我需要补充什么吗?干杯

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(stationary_total_vehicles['all_motor_vehicles'], order = (3,0,0))
results = model.fit(disp=0)

stationary_total_vehicles['forecast'] = results.predict()
stationary_total_vehicles_plot = stationary_total_vehicles[1:]
stationary_total_vehicles_plot.set_index(pd.DatetimeIndex(stationary_total_vehicles_plot['year']))
stationary_total_vehicles_plot[['all_motor_vehicles', 'forecast']].plot(figsize=(12,8))
forecast = results.predict(start=len(stationary_total_vehicles_plot['all_motor_vehicles']), end = len(stationary_total_vehicles_plot['all_motor_vehicles']) + 30).rename('Forecast')
stationary_total_vehicles_plot['all_motor_vehicles'].plot(figsize = (12, 5), legend = True)
forecast.plot(legend=True)