# Breusch–Pagan test

In statistics, the Breusch–Pagan test (named after Trevor Breusch and Adrian Pagan) is used to test for heteroscedasticity in a linear regression model. It tests whether the estimated variance of the residuals from a regression are dependent on the values of the independent variables. In that case, we have heteroskedasticity in our model.

Suppose that we estimate the regression model

$y = \beta_0 + \beta_1 x + u, \,$

and obtain from this fitted model a set of values for $\hat{u}$, the residuals. Ordinary least squares constrains these so that their mean is 0 and so, given the assumption that their variance does not depend on the independent variables, an estimate of this variance can be obtained from the average of the squared values of the residuals. If the assumption is not held to be true, a simple model might be that the variance is linearly related to independent variables. Such a model can be examined by regressing the squared residuals on the independent variables, using an auxiliary regression equation of the form

$\hat{u}^2 = \gamma_0 + \gamma_1 x + v.\,$

This is the basis of the Breusch–Pagan test. If an F-test confirms that the independent variables are jointly significant then the null hypothesis of homoscedasticity can be rejected.

The Breusch–Pagan test tests for conditional heteroscedasticity.[citation needed] It is a chi-squared test:[clarification needed] the test statistic is nχ2 with k degrees of freedom. If the Breusch–Pagan test shows that there is conditional heteroscedasticity, the original regression can be corrected by using the Hansen method[citation needed], using robust standard errors, or re-thinking the regression equation by changing and/or transforming independent variables.

## Procedure

Under the classical assumptions, including homoscedasticity, ordinary least squares is the best linear unbiased estimator (BLUE), i.e., it is unbiased and efficient. The efficiency is lost, however, in the presence of heteroscedastic disturbances. Before deciding upon an estimation method, one may conduct the Breusch–Pagan test to examine the presence of heteroscedasticity. The Breusch–Pagan test is based on models of the type $\sigma_i^2 = h(z_i'\gamma)$ for the variances of the observations where $z_i = (1, z_{2i}, \dots, z_{pi})$ explain the difference in the variances. The null hypothesis is equivalent to the $(p - 1)\,$ parameter restrictions:

$\gamma_2 = \dots = \gamma_p = 0.$

The following Lagrange multiplier (LM) yields the test statistic for the Breusch–Pagan test:[citation needed]

$LM=\left (\frac{\partial l}{\partial\theta} \right )'\left (-E\left [\frac{\partial^2 l}{\partial\theta \partial\theta'} \right ] \right )^{-1}\left(\frac{\partial l}{\partial\theta} \right ).$

This test is analogous to following the simple three-step procedure:[citation needed]

• Step 1: Apply OLS in the model
$y = X\beta+\varepsilon.$

and compute the regression residuals.

• Step 2: Perform the auxiliary regression
$e_i^2=\gamma_1+\gamma_2z_{2i}+\dots+\gamma_pz_{pi}+\eta_i.$
• Step 3: The test statistic is the result of the coefficient of determination of the auxiliary regression in Step 2 and sample size $n\,$ with:
$LM=nR^{2}\, .$

The test statistic is asymptotically distributed as $\chi^2 \left (p - 1 \right )$ under the null hypothesis of homoscedasticity.[citation needed]

## Software

In R, this test is performed by function ncvTest available in the car package, or by function bptest available in the lmtest 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_breushpagan in statsmodels.stats.diagnostic (the statsmodels package) for breusch-pagan test.