regression, to obtain what Breusch and Pagan call : Step 2: Estimate the auxiliary regression where the z terms will typically but not necessarily be the same as the original covariates x. Step 3: The LM test statistic is then half of the explained sum of squares from the auxiliary regression in Step 2: where TSS is the sum of squared deviations of the from their mean of 1, and SSR is the sum of squared residuals from the auxiliary regression. The test statistic is asymptotically distributed as under the null hypothesis of homoskedasticity, as proved by Breusch and Pagan in their 1979 paper. Robust variant A variant of this test, robust in the case of a non-Gaussian error term, was proposed by Roger Koenker. In this variant, the dependent variable in the auxiliary regression is just the squared residual from the Step 1 regression, , and the test statistic is from the auxiliary regression. As Koenker notes (1981, page 111), while the revised statistic has correct asymptotic size its power "may be quite poor except under idealized Gaussian conditions." Software In R, this test is performed by the function ncvTest available in the car package, the function bptest available in the lmtest package, the function plmtest available in the plm package, or the function breusch_pagan available in the skedastic package. In Stata, one specifies the full regression, and then enters the command estat hettest followed by all independent variables. In SAS, Breusch–Pagan can be obtained using the Proc Model option. In Python, there is a method het_breuschpagan in statsmodels.stats.diagnostic (the statsmodels package) for Breusch–Pagan test. In gretl, the command modtest --breusch-pagan can be applied following an OLS regression. See also White test References Further reading Statistical tests Regression diagnostics