简体   繁体   中英

Python - StatsModels, OLS Confidence interval

In Statsmodels I can fit my model using

import statsmodels.api as sm

X = np.array([22000, 13400, 47600, 7400, 12000, 32000, 28000, 31000, 69000, 48600])
y = np.array([0.62, 0.24, 0.89, 0.11, 0.18, 0.75, 0.54, 0.61, 0.92, 0.88])
X2 = sm.add_constant(X)
est = sm.OLS(y, X2)
est2 = est.fit()

then print a nice summary using

print(est2.summary())

and the extract things like the p-values using

est2.pvalues

which can be found on this page http://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.RegressionResults.html

but in the summary there are confidence intervals and I am lost as to how to extract these confidence intervals, like I do with the pvalues.

Apart from seeing them in the summary, how can i get these confidence intervals?

est2.conf_int(alpha=0.05, cols=None)

另请参见statsmodels手册

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM