statsmodels.stats.diagnostic.het_breuschpagan¶

statsmodels.stats.diagnostic.
het_breuschpagan
(resid, exog_het)[source]¶ BreuschPagan Lagrange Multiplier test for heteroscedasticity
The tests the hypothesis that the residual variance does not depend on the variables in x in the form
Math: sigma_i = sigma * f(alpha_0 + alpha z_i) Homoscedasticity implies that $alpha=0$
Parameters:  resid (arraylike) – For the BreuschPagan test, this should be the residual of a regression. If an array is given in exog, then the residuals are calculated by the an OLS regression or resid on exog. In this case resid should contain the dependent variable. Exog can be the same as x. TODO: I dropped the exog option, should I add it back?
 exog_het (array_like) – This contains variables that might create data dependent heteroscedasticity.
Returns:  lm (float) – lagrange multiplier statistic
 lm_pvalue (float) – pvalue of lagrange multiplier test
 fvalue (float) – fstatistic of the hypothesis that the error variance does not depend on x
 f_pvalue (float) – pvalue for the fstatistic
Notes
Assumes x contains constant (for counting dof and calculation of R^2). In the general description of LM test, Greene mentions that this test exaggerates the significance of results in small or moderately large samples. In this case the Fstatistic is preferrable.
Verification
Chisquare test statistic is exactly (<1e13) the same result as bptest in Rstats with defaults (studentize=True).
Implementation This is calculated using the generic formula for LM test using $R^2$ (Greene, section 17.6) and not with the explicit formula (Greene, section 11.4.3). The degrees of freedom for the pvalue assume x is full rank.
References
http://en.wikipedia.org/wiki/Breusch%E2%80%93Pagan_test Greene 5th edition Breusch, Pagan article