The approach followed is the one detailed at Wooldridge, 2012, p. 275. The fitted values from the original model are:
$$\widehat{y_i} = \widehat{\beta_0} + \widehat{\beta_1}x_{i1} + ... + \widehat{\beta_k}x_{ik}$$
Heteroscedasticity could be tested as a linear regression of the squared residuals against the fitted values:
$$\widehat{u^2} = \delta_0 + \delta_1\widehat{y} + \delta_2\widehat{y^2} + error$$
The null hypothesis states that \(\delta_1 = \delta_2 = 0\) (homoskedasticity). The test statistic
is defined as:
$$LM = nR^2$$
where \(R^2\) is the R-squared value from the regression of \(u^2\).