# How do I interpret the results of a Breusch–Pagan test?

In R I can perform a Breusch–Pagan test for heteroscedasticity using the ncvTest function of the car package. A Breusch–Pagan test is a type of chi squared test.

How do I interpret these results:

> require(car)
> set.seed(100)
> x1 = runif(100, -1, 1)
> x2 = runif(100, -1, 1)
> ncvTest(lm(x1 ~ x2))
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 0.2343406    Df = 1     p = 0.6283239
> y1 = cumsum(runif(100, -1, 1))
> y2 = runif(100, -1, 1)
> ncvTest(lm(y1 ~ y2))
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 1.191635    Df = 1     p = 0.2750001


## 2 Answers

Are you asking about these results in particular or the Breusch-Pagan test more generally? For these particular tests, see @mpiktas's answer. Broadly, the BP test asks whether the squared residuals from a regression can be predicted using some set of predictors. These predictors may be the same as those from the original regression. The White test version of the BP test includes all the predictors from the original regression, plus their squares and interactions in a regression against the squared residuals. If the squared residuals are predictable using some set of covariates, then the estimated squared residuals and thus the variances of the residuals (which follows because the mean of the residuals is 0) appear to vary across units, which is the definition of heteroskedasticity or non-constant variance, the phenomenon that the BP test considers.

First application of ncvTest reports that there is no heteroscedasticity, as it should. The second is not meaningful, since your dependent random variable is random walk. Breusch-Pagan test is assymptotic, so I suspect that it cannot be readily applied for random walk. I do not think that there are tests for heteroscedasticity for random walks, due to the fact that non-stationarity poses much more problems than the heteroscedasticity, hence testing for the latter in the presence of the former is not practical.