statsmodels-OLS模型预测的置信区间

2024-05-28 20:08:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个与this问题非常相似的问题,它适用于训练数据。现在我试着得到预测数据的置信区间:

from statsmodels.sandbox.regression.predstd import wls_prediction_std
#define y, X, X_forecast as pandas dataframes
regressor = sm.api.OLS(y, X).fit()
wls_prediction_std(regressor.predict(X_forecast))

但是,当然,会给出一个错误,抱怨regressor.predict是一个数组。如何计算预测回归值的置信区间?在


Tags: 数据fromimportthispredictstdsandboxprediction

热门问题