white {skedastic} | R Documentation |
White's Test for Heteroskedasticity in a Linear Regression Model
Description
This function implements the popular method of White (1980) for testing for heteroskedasticity in a linear regression model.
Usage
white(mainlm, interactions = FALSE, statonly = FALSE)
Arguments
mainlm |
Either an object of |
interactions |
A logical. Should two-way interactions between explanatory
variables be included in the auxiliary regression? Defaults to
|
statonly |
A logical. If |
Details
White's 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 includes the original explanatory variables, their squares, and (optionally) their two-way interactions. The test statistic is the number of observations multiplied by the coefficient of determination from the auxiliary regression model:
T = n r_{\mathrm{aux}}^2
White's Test is thus a special case of the method of
Breusch and Pagan (1979). 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.
White H (1980).
“A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity.”
Econometrica, 48(4), 817–838.
See Also
This function should not be confused with
tseries::white.test
, which does
not implement the method of
White (1980) for testing for
heteroskedasticity in a linear model.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
white(mtcars_lm)
white(mtcars_lm, interactions = TRUE)