'To which value in the statsmodels summary relates the error bar size in the plot?

With the following code, I get a plot how the regression was done for my data.

In the plot also vertical (error?) bars are shown.

To which number in the summary refers the length of these bars, respectively: how can I derive the size of the bars from the summary (or from any quantity I could retrieve from the model)?

The code:

import random
random.seed(42)
import statsmodels.api as smapi
from statsmodels.formula.api import ols
import statsmodels.graphics as smgraphics
# Make data #
x = list(range(30))
y = [y*(10+random.random())+200 for y in x]
# Add outlier #
x.insert(6,15)
y.insert(6,220)
x.insert(6,16)
y.insert(6,295)
# Make fit #
regression = ols("data ~ x", data=dict(data=y, x=x)).fit()
# Find outliers #
test = regression.outlier_test()

outliers = ((x[i],y[i]) for i,t in enumerate(test.iloc[:,2]) if t < 0.5)

print(regression.summary())

figure = smgraphics.regressionplots.plot_fit(regression, 1)
figure.show()

The summary:

                            OLS Regression Results                            
==============================================================================
Dep. Variable:                   data   R-squared:                       0.913
Model:                            OLS   Adj. R-squared:                  0.910
Method:                 Least Squares   F-statistic:                     314.1
Date:                Thu, 18 Apr 2019   Prob (F-statistic):           1.92e-17
Time:                        10:47:19   Log-Likelihood:                -150.87
No. Observations:                  32   AIC:                             305.7
Df Residuals:                      30   BIC:                             308.7
Df Model:                           1                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
Intercept    193.8136      9.880     19.618      0.000     173.637     213.990
x             10.4202      0.588     17.724      0.000       9.219      11.621
==============================================================================
Omnibus:                       57.423   Durbin-Watson:                   1.316
Prob(Omnibus):                  0.000   Jarque-Bera (JB):              379.511
Skew:                          -3.901   Prob(JB):                     3.89e-83
Kurtosis:                      17.958   Cond. No.                         33.8
==============================================================================
Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.

The plot:

plot



Solution 1:[1]

To which value in the statsmodels summary relates the error bar size in the plot?

They are not "error bars". They are prediction intervals and they can't be computed from the summary output.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert Long