I used the statsmodels.formula.api
as below to calculate P-values. But apparently, this is not working in the new versions of the library. Do you know an alternative tool?
import statsmodels.formula.api as sm
# ...
regressor_OLS = sm.OLS(Y, x).fit()
Error:
AttributeError: module 'statsmodels.formula.api' has no attribute 'OLS'
Use statsmodels.api
, instead of statsmodels.formula.api
.
try changingregressor_OLS = sm.OLS(Y, x).fit()
toregressor_OLS = sm.OLS(endog=Y, exog=x).fit()
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.