Skip to content

# Heteroskedasticity: Breusch-Pagan and White Tests in R Video

Last Update: March 22, 2022

My online video tutorials are hosted at YouTube channel.

For learning this concept, you can view my online video tutorial: Heteroskedasticity: Breusch-Pagan and White Tests in R.

Video Code

1. Packages

library(AER)
library(lmtest)


2. Data

data(HousePrices)

3. Model

mlr <- lm(formula = price ~ lotsize + bedrooms, data = HousePrices)

4. Heteroskedasticity

Breusch-Pagan Test

$\hat{residuals^2}&space;=&space;\hat{\gamma}_{0}&space;+&space;\hat{\gamma}_{1}*lotsize&space;+&space;\hat{\gamma}_{2}*bedrooms$

bptest(formula = mlr, varformula = ~ lotsize + bedrooms,
data = HousePrices)


White Test (Cross Terms)

$\hat{residuals^2}&space;=&space;\hat{\gamma}_{0}&space;+&space;\hat{\gamma}_{1}*lotsize&space;+&space;\hat{\gamma}_{2}*(lotsize^2)&space;+&space;\hat{\gamma}_{3}*(lotsize*bedrooms)&space;+&space;\hat{\gamma}_{4}*bedrooms&space;+&space;\hat{\gamma}_{5}*(bedrooms^2)$

bptest(formula = mlr, varformula = ~ lotsize + I(lotsize^2) +
lotsize*bedrooms + bedrooms + I(bedrooms^2), data = HousePrices)


Courses

My online courses are hosted at Teachable website.

For more details on this concept, you can view my Linear Regression in R Course.

+