简体   繁体   中英

How to return slope from OLS in statsmodels

I am fitting an OLS model using statsmodels. I need to return the slope of the fitted line.

model = sm.OLS(y, X)
results = model.fit()

results.fittedvalues gives me the points of the line. How to get the slope?

results.params包含所有使用的变量的“斜率”。

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