# Breusch Pagan and White test always 0

I'm working on a machine learning algorithm and trying to evaluate the model based on a guide online. No matter how I change the features of the model, the results of both tests are always 0. Is there a problem with calculation or the model? I'm having a hard time understanding why this is happening from reading online, so anything helps! I'll place relevant code below

# Applying model to be used with the statsmodel package (needs a constant)

# create a OLS model
model = sm.OLS(Y, X2)

# fit the data
est = model.fit()

_, pval, __, f_pval = diag.het_white(est.resid, est.model.exog, retres = False)
print(pval, f_pval)

_, pval, __, f_pval = diag.het_breuschpagan(est.resid, est.model.exog)
print(pval, f_pval)


and the output

0.0 0.0
----------------------------------------------------------------------------------------------------
0.0 0.0



Not an answer, but an extended comment because there isn't enough information.

It might be you running an old version, I am on 0.11.1 and according to the the vignette, there isn't an argument for "retres=":

statsmodels.stats.diagnostic.het_white(resid, exog)


And it returns:

lmfloat
The lagrange multiplier statistic.

lm_pvalue :float
The p-value of lagrange multiplier test.

fvaluefloat
The f-statistic of the hypothesis that the error variance does not depend on x. This is an alternative test variant not the original LM test.

f_pvaluefloat
The p-value for the f-statistic.


If I run it on an example dataset it works, so you need to show some examples of your dataset..

import numpy as np
import statsmodels.api as sm
from statsmodels.stats import diagnostic

np.random.seed(100)
X = np.random.normal(0,1,(50,5))