Title: | White Test and Bootstrapped White Test for Heteroskedasticity |
---|---|
Description: | Formal implementation of White test of heteroskedasticity and a bootstrapped version of it, developed under the methodology of Jeong, J., Lee, K. (1999) <https://yonsei.pure.elsevier.com/en/publications/bootstrapped-whites-test-for-heteroskedasticity-in-regression-mod>. |
Authors: | Jorge Lopez Perez [aut, cre, cph], Jinook Jeong [ctb] |
Maintainer: | Jorge Lopez Perez <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1 |
Built: | 2024-11-03 05:36:09 UTC |
Source: | https://github.com/jlopezper/whitestrap |
White's test is a statistical test that determines whether the variance of the residuals in a regression model is constant.
white_test(model)
white_test(model)
model |
An object of class |
The approach followed is the one detailed at Wooldridge, 2012, p. 275. The fitted values from the original model are:
Heteroscedasticity could be tested as a linear regression of the squared residuals against the fitted values:
The null hypothesis states that (homoskedasticity). The test statistic
is defined as:
where is the R-squared value from the regression of
.
AA list with class white_test
containing:
w_stat |
The value of the test statistic |
p_value |
The p-value of the test |
White, H. (1980). A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity. Econometrica, 48(4), 817-838.
Wooldridge, Jeffrey M., 1960-. (2012). Introductory econometrics : a modern approach. Mason, Ohio : South-Western Cengage Learning,
# Define a dataframe with heteroscedasticity n <- 100 y <- 1:n sd <- runif(n, min = 0, max = 4) error <- rnorm(n, 0, sd*y) X <- y + error df <- data.frame(y, X) # OLS model fit <- lm(y ~ X, data = df) # White's test white_test(fit)
# Define a dataframe with heteroscedasticity n <- 100 y <- 1:n sd <- runif(n, min = 0, max = 4) error <- rnorm(n, 0, sd*y) X <- y + error df <- data.frame(y, X) # OLS model fit <- lm(y ~ X, data = df) # White's test white_test(fit)
This is a versioned White's test based on a bootstrap procedure that can improve the performance of White’s test, specially in small samples. It was proposed by Jeong, J., Lee, K. (1999) (see references for further details).
white_test_boot(model, bootstraps = 1000)
white_test_boot(model, bootstraps = 1000)
model |
An object of class |
bootstraps |
Number of bootstrap to be performed. If 'bootstraps' is less than 10, it will automatically be set to 10. At least 500 simulations are recommended. Default value is set to 1000. |
The bootstrapped error term is defined by:
where follows a distribution satisfying
and
.
In particular, the selected distribution of can be found at the bottom of page 196 at Handbook of Computational Econometrics (2009).
A list with class white_test
containing:
w_stat |
The value of the test statistic |
p_value |
The p-value of the test |
iters |
The number of bootstrap samples |
Jeong, J., & Lee, K. (1999). Bootstrapped White’s test for heteroskedasticity in regression models. Economics Letters, 63(3), 261-267.
White, H. (1980). A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity. Econometrica, 48(4), 817-838.
Wooldridge, Jeffrey M., 1960-. (2012). Introductory econometrics : a modern approach. Mason, Ohio : South-Western Cengage Learning,
# Define a dataframe with heteroscedasticity n <- 100 y <- 1:n sd <- runif(n, min = 0, max = 4) error <- rnorm(n, 0, sd*y) X <- y + error df <- data.frame(y, X) # OLS model fit <- lm(y ~ X, data = df) # White's test white_test_boot(fit)
# Define a dataframe with heteroscedasticity n <- 100 y <- 1:n sd <- runif(n, min = 0, max = 4) error <- rnorm(n, 0, sd*y) X <- y + error df <- data.frame(y, X) # OLS model fit <- lm(y ~ X, data = df) # White's test white_test_boot(fit)