cook_weisberg {skedastic} | R Documentation |
Cook-Weisberg Score Test for Heteroskedasticity in a Linear Regression Model
Description
This function implements the score test of Cook and Weisberg (1983) for testing for heteroskedasticity in a linear regression model.
Usage
cook_weisberg(
mainlm,
auxdesign = NA,
hetfun = c("mult", "add", "logmult"),
statonly = FALSE
)
Arguments
mainlm |
Either an object of |
auxdesign |
A |
hetfun |
A character describing the form of |
statonly |
A logical. If |
Details
The Cook-Weisberg Score Test entails fitting an auxiliary
regression model in which the response variable is the vector of
standardised squared residuals e_i^2/\hat{\omega}
from the original
OLS model and the design matrix is some function of Z
, an
n \times q
matrix consisting of q
exogenous variables,
appended to a column of ones. The test statistic is half the residual sum
of squares from this auxiliary regression. Under the null hypothesis of
homoskedasticity, the distribution of the test statistic is
asymptotically chi-squared with q
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
Cook RD, Weisberg S (1983).
“Diagnostics for Heteroscedasticity in Regression.”
Biometrika, 70(1), 1–10.
Griffiths WE, Surekha K (1986).
“A Monte Carlo Evaluation of the Power of Some Tests for Heteroscedasticity.”
Journal of Econometrics, 31(1), 219–231.
See Also
car::ncvTest
, which implements the same
test. Calling car::ncvTest
with var.formula
argument omitted
is equivalent to calling skedastic::cook_weisberg
with
auxdesign = "fitted.values", hetfun = "additive"
. Calling
car::ncvTest
with var.formula = ~ X
(where X
is the
design matrix of the linear model with the intercept column omitted) is
equivalent to calling skedastic::cook_weisberg
with default
auxdesign
and hetfun
values. The
hetfun = "multiplicative"
option has no equivalent in
car::ncvTest
.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
cook_weisberg(mtcars_lm)
cook_weisberg(mtcars_lm, auxdesign = "fitted.values", hetfun = "logmult")