View source: R/breusch_pagan.R
| breusch_pagan | R Documentation | 
This function implements the popular method of \insertCiteBreusch79;textualskedastic for testing for heteroskedasticity in a linear regression model, with or without the studentising modification of \insertCiteKoenker81;textualskedastic.
breusch_pagan(mainlm, auxdesign = NA, koenker = TRUE, statonly = FALSE)
| mainlm | Either an object of  | 
| auxdesign | A  | 
| koenker | A logical. Should studentising modification of
\insertCiteKoenker81;textualskedastic be implemented? Defaults to
 | 
| statonly | A logical. If  | 
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 Z 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
Z, 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.
An object of class "htest". If object
is not assigned, its attributes are displayed in the console as a
tibble using tidy.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.