模型预测的置信区间 [英] Confidence intervals for model prediction

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

问题描述

我正在关注 statsmodels 教程

一个OLS模型装有

formula = 'S ~ C(E) + C(M) + X' 
lm = ols(formula, salary_table).fit()
print lm.summary()

通过以下方式提供预测值:

Predicted values are provided through:

lm.predict({'X' : [12], 'M' : [1], 'E' : [2]})

结果作为单值数组返回.

The result is returned as a single value array.

是否有一种方法也可以返回 statsmodels 中预测值(预测区间)的置信区间?

Is there a method to also return confidence intervals for the predicted value (prediction intervals) in statsmodels?

谢谢.

推荐答案

我们一直想让这更容易获得.你应该可以使用

We've been meaning to make this easier to get to. You should be able to use

from statsmodels.sandbox.regression.predstd import wls_prediction_std
prstd, iv_l, iv_u = wls_prediction_std(results)

如果您有任何问题,请在github上提交问题.

If you have any problems, please file an issue on github.

这篇关于模型预测的置信区间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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