我正在做一个学校项目,该项目可以根据年份来预测人数,但是我必须考虑所接订单(取决于年份)和销售(取决于年份),以减少MSE
但是我真的不知道该怎么做,除非使用SARIMAX,但不能考虑我之前说过的任何功能
如果您能帮助我,我将不胜感激
mod = sm.tsa.statespace.SARIMAX(y,
order=(1, 1, 1),
seasonal_order=(0, 0, 0, 12),
enforce_stationarity=False,
enforce_invertibility=False)
results = mod.fit()
print(results.summary().tables[1])pred_uc = results.get_forecast(steps=5)
pred_ci = pred_uc.conf_int()
pred = results.get_prediction()
pred_ci = pred.conf_int()
ax = y['2014':].plot(label='observed')
pred.predicted_mean.plot(ax=ax, label='One-step ahead Forecast', alpha=.7, figsize=(14, 7))
ax.fill_between(pred_ci.index,
pred_ci.iloc[:, 0],
pred_ci.iloc[:, 1], color='k', alpha=.2)
ax.set_xlabel('Years')
ax.set_ylabel('Dvlpment Staff')
plt.legend()
plt.show()
ax = y.plot(label='observed', figsize=(14, 7))
pred_uc.predicted_mean.plot(ax=ax, label='Forecast')
ax.fill_between(pred_ci.index,
pred_ci.iloc[:, 0],
pred_ci.iloc[:, 1], color='k', alpha=.25)
ax.set_xlabel('Years')
ax.set_ylabel('Dvlpment Staff')
plt.legend()
plt.show()