auto arima python中的预测间隔 [英] Prediction interval in auto arima python

查看:45
本文介绍了auto arima python中的预测间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 python 中使用 auto arima 计算 .95 预测区间.我想得到预测的标准误差,就像我们在 R 中的 stats predict 中得到的一样.

I want to calculate .95 prediction interval using auto arima in python .I want to get the standard error of forecast like we can get in stats predict in R.

那我就用公式——点预测±1.96*t时刻预测的标准误差得到上下界.

Then I will use the formula - point forecast ± 1.96 * Standard error of forecast at that time t to get upper and lower bounds.

如何在 python 中获得预测的标准误差.我正在为此使用自动 arima 预测.我知道 statsmodel 预测有标准错误参数来获取这些,但我使用的是 Auto arima predict.请告诉我如何获得 auto arima 中 10 个时间步长的预测间隔?return Conf interval 参数返回非常宽的上下范围区间.如何获得 arima (1 0 2) 订单预测的标准误差.

How can I get the standard error of forecast for this in python. I am using auto arima predict for this. I know that statsmodel forecast has std error parameter to get these but I am using Auto arima predict. Please tell me how can I get the prediction interval for 10 time steps in auto arima? The return Conf interval parameter returns very wide upper and lower range interval. How can I get the standard error of forecasting for arima (1 0 2) order.

推荐答案

Auto arima 通过将 statsmodels.tsa.ARIMAstatsmodels.tsa.statespace.SARIMAX 包装在一起来工作作为估计者.您可以像使用 statsmodels 一样提取结果.这是一个示例模型:

Auto arima works by wrapping statsmodels.tsa.ARIMA and statsmodels.tsa.statespace.SARIMAX together as an estimator. You may extract the results the same way you do it with statsmodels. Here is a sample model:

 model = auto_arima(y_train, start_p=0, start_q=0,
            test='adf',       
            max_p=7, max_q=7, 
            m=np.int(season),             
            d=n_diffs,           
            seasonal=True,  
            start_P=0, 
            D=1, 
            trace=True,
            error_action='ignore',  
            suppress_warnings=True, 
            stepwise=True)

print(model.conf_int())

将返回一个具有 95% 拟合参数置信区间的数组.请随时阅读此文档SARIMAX 结果 了解有关模型结果的更多信息.

would return you an array with 95 % confidence interval of fitted parameters. Please feel free to go through this documentation SARIMAX results to know more about results of the model.

对于 10 步预测,您可以执行以下操作以获得置信区间:

For 10 step prediction, you may do the following to get the confidence interval:

y_forec, conf_int  = model.predict(10,return_conf_int=True,alpha=0.05)
print(conf_int)

要获得模型标准误差,您可以使用以下方法提取标准误差:

To get model standard error, you may extract the standard error with:

std_error = model.bse()

要获得预测标准误差,应使用置信区间来获得标准误差.这是一个解释相同的答案:std_err for forecastwiki 标准误差和预测区间关系

To get prediction standard error, the confidence intervals shall be used to obtain the standard error. Here is an answer explaining the same: std_err for forecast wiki for standard error and pred interval relation

这篇关于auto arima python中的预测间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆