I am trying to get summary in Backward-elimination method of Multiple linear regression and getting the error.
Here is the code in which I am getting error.
X_opt = X[:, [0,1,2,3,4,5]]
regressor_OLS = sm.OLS(endog=Y, exog=X_opt).fit
regressor_OLS.summary()
AttributeError Traceback (most recent call last)
<ipython-input-26-c8a038cdb955> in <module>
----> 1 regressor_OLS.summary()
AttributeError: 'function' object has no attribute 'summary'
It should simply return the table of regressor but it is showing error.
You can solve it by two different ways:
regressor_OLS = sm.OLS(endog=Y, exog=X_opt)
results = regressor_OLS.fit()
or:
regressor_OLS = sm.OLS(endog=Y, exog=X_opt).fit()
I hope helped you :)