# How to use White-test to check if the heteroscedasticity has been effectively dealt with by a WLS?

Consider an OLS model with $$n$$ observations and $$p$$ explanatory variables (including an intercept term) $$y=X\beta + \epsilon$$ We may use a White test to (approximately) check for the presence of heteroscedasticity on an $$\alpha$$-significance level, by conducting an auxiliary regression: $$e = Y\gamma + \eta$$ where $$e=y-X\widehat\beta$$ ($$\widehat\beta$$ is the OLS estimator of $$\beta$$) and $$Y$$ is the matrix of all the auxiliary regression variables $$1, X_i, X_i\odot X_j$$. The Lagrange multiplier statistic $$nR^2$$ of this auxiliary regression is then compared against $$\chi_\alpha^2(p)$$. If $$nR^2>\chi_\alpha^2(p)$$, the null hypothesis that $$\epsilon$$ is homoscedastic is rejected.

Now suppose we believe $$\epsilon$$ is heteroscedastic with $$\Bbb V(\epsilon\mid X) = \Lambda$$ where $$\Lambda$$ is a positive diagonal matrix. Then we may use a WLS model to reestimate the original OLS by specifying the weight $$W:=\Lambda^{-1}$$, and premultiply the original model by $$W^{1/2}$$ to obtain $$W^{1/2}y=W^{1/2}X\beta+W^{1/2}\epsilon$$ and the WLS estimator of $$\beta$$ which is an OLS estimator of $$\beta$$ under the transformed model should be $$\widehat\beta_{W}=(X^TWX)^{-1}X^TWy.$$ Question: how do we use a White test to measure how accurately $$W$$ has captured the real heteroscedasticity structure?

A naive thought would be just using the WLS residual $$e_W:=y-X\widehat\beta_W$$ and the original $$Y$$ as the inputs for the White test. However, it is evident that $$\Bbb E(\widehat\beta_W)=(X^TWX)^{-1}X^TW\Bbb E(y)=(X^TWX)^{-1}X^TWX\beta=\beta=\Bbb E(\widehat\beta)$$ so $$\widehat\beta_W$$ usually shouldn't deviate too much from $$\widehat\beta$$, and thus $$e_W$$ won't be much different from $$e$$. Hence such a way of "White test" can tell little about how well $$\Bbb V(\epsilon\mid X)$$ is addressed by $$W$$.

Another more plausible thought is consider the transformed model instead of the original OLS model, i.e. use the weighted residual $$W^{1/2}e_W$$ for the auxiliary regression. But when it comes to choosing the explanatory variables we'll have a problem: should we choose the original $$Y$$ (spanned by zero, first and second degree terms of $$X$$)? It seems weird matching $$W^{1/2}e_W$$. So a more natural idea would be matching $$e_W$$ with $$W^{1/2}X$$. But wait, there's no longer an intercept term in $$W^{1/2}X$$, and there seems to be no way to naturally construct auxiliary variables from $$W^{1/2}X$$ without introducing a new dof..

So how is this done in reality?

Given you know $$W$$, then let $$Y_{new} = W^{1/2}Y$$ and $$X_{new} = W^{1/2}X$$. Then forget about $$Y$$ and $$X$$. Go back to use $$Y_{new}$$ and $$X_{new}$$ to perform OLS, to use a White test to (approximately) check for the presence of heteroscedasticity.

• Thanks but my problem lie exactly in how to use X_new for the White test? The original intercept term is lost when premultiplied by $W^{1/2}$, and if we "forcefully" introduce a new intercept term, well, we effectively introduce a new dof in $X_{new}$....
– Vim
Nov 2 '18 at 17:44
• How do you lost intercept? In addition, white test does not require intercept. Suppose you have a intercept and 4 slopes in the Y-X model. In your new model $Y_{new}-X_{new}$, you still have 5 regression coefficients, right? Nov 2 '18 at 17:51
• $W^{1/2}X$ no longer has an intercept column (the initial intercept column in $X$ is turned into a non constant column namely varies with rows).
– Vim
Nov 3 '18 at 6:08
• It is OK, just use $X_{new}$ . The number of columns in $X_{new}$ and $X$ are the same. The first column of $X$ is 1, and the first column of $X_{new}$ is not only 1. But it does not matter. Nov 3 '18 at 6:13
• actually it does matter. Theoretically, White test requires an intercept to be used. Also if I only pass $X_{new}$ to the white test function of a statistical package (say Python statsmodels.api) then an Error occurs saying the model dof doesn't match with the rank of $Y_{new}$.
– Vim
Nov 3 '18 at 6:17