I used the
statsmodels package to estimate my OLS regression. Now I want
Breusch Pagan test. I used the
pysal package for this test but this function returns an error:
import statsmodels.api as sm
model = sm.OLS(Y,X,missing = 'drop')
rs = model.fit()
AttributeError: 'OLSResults' object has no attribute 'u'
What should I do?
Best How To :
The problem is that the regression results instance of statsmodels is not compatible with the one in pysal.
You can use
breushpagan from statsmodels, which takes OLS residuals and candidates for explanatory variables for the heteroscedasticity and so it does not rely on a specific model or implementation of a model.
with examples here http://statsmodels.sourceforge.net/devel/examples/notebooks/generated/regression_diagnostics.html
I do not know if there are any essential differences in the implementation of the Breusch-Pagan test.
It looks like the name is misspelled in statsmodels.