vij*_*vij 1 python prediction intervals arima
我想在 python 中使用 auto arima 计算 0.95 预测区间。我想得到预测的标准误差,就像我们可以在 R 中的 stats predict 中得到的那样。
那我就用公式——点预测±1.96*t时刻预测的标准误差得到上下界。
如何在 python 中获得预测的标准误差。我正在为此使用自动 arima 预测。我知道 statsmodel 预测有标准错误参数来获取这些,但我使用的是 Auto arima predict。请告诉我如何获得 auto arima 中 10 个时间步长的预测间隔?return Conf interval 参数返回非常宽的上下范围区间。如何获得 arima (1 0 2) 订单预测的标准误差。
Auto arima 通过包装statsmodels.tsa.ARIMA和statsmodels.tsa.statespace.SARIMAX一起作为估算器来工作。您可以像使用 statsmodels 一样提取结果。这是一个示例模型:
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)
Run Code Online (Sandbox Code Playgroud)
和
print(model.conf_int())
Run Code Online (Sandbox Code Playgroud)
将返回一个具有 95% 拟合参数置信区间的数组。请随时阅读此文档SARIMAX 结果以了解有关模型结果的更多信息。
对于 10 步预测,您可以执行以下操作来获得置信区间:
y_forec, conf_int = model.predict(10,return_conf_int=True,alpha=0.05)
print(conf_int)
Run Code Online (Sandbox Code Playgroud)
要获得模型标准误差,您可以使用以下方法提取标准误差:
std_error = model.bse()
Run Code Online (Sandbox Code Playgroud)
为了得到预测标准误差,应使用置信区间来获得标准误差。这是一个解释相同的答案:std_err for forecast wiki for standard error and pred interval relationship