如何获得 ARIMA 模型上每个预测的置信区间 [英] How to get the confidence interval of each prediction on an ARIMA model
问题描述
我正在尝试模糊"使用 SARIMA 模型预测时间序列
I'm trying to get a "fuzzy" prediction of a timeseries, using an SARIMA model
我的训练集是prices_train
,模型构建如下:
My training set is prices_train
, and the model is built as follows:
model_order = (0, 1, 1)
model_seasonal_order = (2, 1, 1, 24)
model = sm.tsa.statespace.SARIMAX(
prices_train, order=model_order,
seasonal_order=model_seasonal_order)
model_fit = model.fit(disp=0)
我知道我可以使用此说明获得积分预测:
I know I can get a point forecast using this instruction:
pred = model_fit.forecast(3)
但我不想要点预测,我想要每个预测值的置信区间,这样我就可以得到预测值的模糊时间序列
But I don't want a point forecast, I want a confidence interval of each predicted value so I can have a fuzzy timeseries of predicted values
我看过诸如这个,他们在其中应用此代码:
I've seen tutorials such as this one, where they apply this code:
forecast, stderr, conf = model_fit.forecast(alpha=a)
但是,该库似乎自 2017 年以来已更新,因为那不起作用.我已经阅读了 statsmodels
手册,但我没有找到太多帮助.
However, it seems the library has been updated since 2017, because that does not work. I've read the statsmodels
manual but I haven't found much help.
推荐答案
你的拟合模型应该有一个 get_prediction() 函数来返回一个预测.然后你可以调用prediction.conf_int(alpha=a)
.
Your fit model should have a get_prediction() function that returns a prediction.
Then you can call prediction.conf_int(alpha=a)
.
这篇关于如何获得 ARIMA 模型上每个预测的置信区间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!