breusch_pagan {skedastic} | R Documentation |
Breusch-Pagan Test for Heteroskedasticity in a Linear Regression Model
Description
This function implements the popular method of Breusch and Pagan (1979) for testing for heteroskedasticity in a linear regression model, with or without the studentising modification of Koenker (1981).
Usage
breusch_pagan(mainlm, auxdesign = NA, koenker = TRUE, statonly = FALSE)
Arguments
mainlm |
Either an object of |
auxdesign |
A |
koenker |
A logical. Should studentising modification of
Koenker (1981) be implemented? Defaults to
|
statonly |
A logical. If |
Details
The Breusch-Pagan Test entails fitting an auxiliary regression
model in which the response variable is the vector of squared residuals
from the original model and the design matrix consists of one or
more exogenous variables that are suspected of being related to the error
variance. In the absence of prior information on a possible choice of
, one would typically use the explanatory variables from the
original model. Under the null hypothesis of homoskedasticity, the
distribution of the test statistic is asymptotically chi-squared with
parameter
degrees of freedom. The test is right-tailed.
Value
An object of class
"htest"
. If object
is not assigned, its attributes are displayed in the console as a
tibble
using tidy
.
References
Breusch TS, Pagan AR (1979).
“A Simple Test for Heteroscedasticity and Random Coefficient Variation.”
Econometrica, 47(5), 1287–1294.
Koenker R (1981).
“A Note on Studentizing a Test for Heteroscedasticity.”
Journal of Econometrics, 17, 107–112.
See Also
lmtest::bptest
, which performs exactly
the same test as this function; car::ncvTest
,
which is not the same test but is implemented in
cook_weisberg
; white
, which is a special
case of the Breusch-Pagan Test.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
breusch_pagan(mtcars_lm)
breusch_pagan(mtcars_lm, koenker = FALSE)
# Same as first example
mtcars_list <- list("y" = mtcars$mpg, "X" = cbind(1, mtcars$wt, mtcars$qsec, mtcars$am))
breusch_pagan(mtcars_list)