Skip to content

Perform White's test for heteroscedasticity

Source: man/performWhiteTest.Rd · Help: ?performWhiteTest

Implements White's test on a fitted linear model.

Usage

performWhiteTest(model, data = NULL, cross_products = TRUE, max_interactions = 10)

Arguments

model
an object of class lm.
data
Data frame used to fit model. When NULL, the default, the model frame of model is used. It holds the terms of the model rather than its variables (log(x) rather than x), so a model that transforms a variable needs data, as does a model with an offset() term, and so may a fit whose weights or offset argument is a column of the data, which the model frame holds as (weights) or (offset).
cross_products
Logical. Include cross-product terms in the auxiliary regression?
max_interactions
Maximum number of cross-product terms admitted to the auxiliary regression. Guards the auxiliary design against growing quadratically with the number of regressors.

Value

An object of class htest containing the test statistic, p-value and degrees of freedom.

Details

An auxiliary regression of \(e^2\) on all regressors, their squares and cross-products produces \(R^2\). The statistic \(n R^2\) follows a chi-square distribution with degrees of freedom equal to the number of regressors in the auxiliary model.

Weighted fits

On a fit with weights the test is computed from the Pearson residuals \(\sqrt{w_i}\, e_i\), so it tests whether the weights are adequate; see the section on weighted fits in performKoenkerTest(), which also covers weights estimated by fitWLS().

References

White, H. (1980). A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity. Econometrica, 48(4), 817–838. doi:10.2307/1912934

Greene, W. H. (2018). Econometric Analysis (8th ed.). Pearson.

Examples

 data(mtcars)
 m <- lm(mpg ~ wt + qsec, data = mtcars)
 performWhiteTest(m, mtcars)