To verify the function AER::bptest, I manually calculate the test statistic. The manual method and R function give the same result for the Breusch-Pagan test, but not for the White test.

Am I using the bptest incorrectly, or is my manual calculation wrong?

# A heteroskedastic DGP
x <- rnorm(500)
u <- rnorm(500, sd = sqrt(abs(x)))
y <- 0.01 * x + u

# Manual
m_white <- lm(y ~ x)
uhat <- resid(m_white) ; yhat <- predict(m_white)
m_white_stage2 <- lm(I(uhat^2) ~ yhat + I(yhat^2))

# The test statistic differs!
bptest(m_white, ~ yhat + I(yhat^2))$statistic

1 Answer 1


I believe you are asking why these two results are different:

bptest(m_white, ~ yhat + I(yhat^2))$statistic

The reason is, the first one reports the f-statistic that will use the f distribution to to calculate the p-value. The second one returns the LM statistic that will use a chi square distribution to calculate the p-value.

For the manual calculation, you could have calculated the LM statistic and then tested the significance by continuing with:

# R2:
(r2 <- summary(m_white_stage2)$r.squared)
# LM statistic, which will be the same as bptest:
(LM <- r2*(500))
# p value for chi-squared distribution with k=3 degrees of freedom:
pchisq(LM, df=2, lower.tail=FALSE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.