- statsmodels.stats.diagnostic.spec_white(resid, exog)¶
White’s Two-Moment Specification Test
White’s test for heteroskedasticity.
Implements the two-moment specification test described by White’s Theorem 2 (1980, p. 823) which compares the standard OLS covariance estimator with White’s heteroscedasticity-consistent estimator. The test statistic is shown to be chi-square distributed.
Null hypothesis is homoscedastic and correctly specified.
Assumes the OLS design matrix contains an intercept term and at least one variable. The intercept is removed to calculate the test statistic.
Interaction terms (squares and crosses of OLS regressors) are added to the design matrix to calculate the test statistic.
Degrees-of-freedom (full rank) = nvar + nvar * (nvar + 1) / 2
Linearly dependent columns are removed to avoid singular matrix error.