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
import pysal
model = sm.OLS(Y,X,missing = 'drop')
rs = model.fit()
pysal.spreg.diagnostics.breusch_pagan(rs)
```

returned error:

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.

documentation: http://statsmodels.sourceforge.net/devel/generated/statsmodels.stats.diagnostic.het_breushpagan.html

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.