bickel {skedastic}R Documentation

Bickel's Test for Heteroskedasticity in a Linear Regression Model

Description

This function implements the method of Bickel (1978) for testing for heteroskedasticity in a linear regression model, with or without the scale-invariance modification of Carroll and Ruppert (1981).

Usage

bickel(
  mainlm,
  fitmethod = c("lm", "rlm"),
  a = "identity",
  b = c("hubersq", "tanhsq"),
  scale_invariant = TRUE,
  k = 1.345,
  statonly = FALSE,
  ...
)

Arguments

mainlm

Either an object of class "lm" (e.g., generated by lm), or a list of two objects: a response vector and a design matrix. The objects are assumed to be in that order, unless they are given the names "X" and "y" to distinguish them. The design matrix passed in a list must begin with a column of ones if an intercept is to be included in the linear model. The design matrix passed in a list should not contain factors, as all columns are treated 'as is'. For tests that use ordinary least squares residuals, one can also pass a vector of residuals in the list, which should either be the third object or be named "e".

fitmethod

A character indicating the method to be used to fit the regression model. This can be "OLS" for ordinary least squares (the default) or "robust" in which case a robust fitting method is called from rlm.

a

A character argument specifying the name of a function to be applied to the fitted values, or an integer m in which case the function applied is f(x) = x^m. Defaults to "identity" for identity.

b

A character argument specifying a function to be applied to the residuals. Defaults to Huber's function squared, as recommended by Carroll and Ruppert (1981). Currently the only supported functions are "hubersq" (for Huber's function squared) and "tanhsq" (for b(x)=\mathrm{tanh}(x)^2.)

scale_invariant

A logical indicating whether the scale-invariance modification proposed by Carroll and Ruppert (1981) should be implemented. Defaults to TRUE.

k

A double argument specifying a parameter for Huber's function squared; used only if b == "hubersq". This is not to be confused with the argument k2 that could be passed to rlm if the regression is fitted using robust methods. k defaults to 1.345.

statonly

A logical. If TRUE, only the test statistic value is returned, instead of an object of class "htest". Defaults to FALSE.

...

Optional arguments to be passed to rlm

Details

Bickel's Test is a robust extension of Anscombe's Test (Anscombe 1961) in which the OLS residuals and estimated standard error are replaced with an M estimator. Under the null hypothesis of homoskedasticity, the distribution of the test statistic is asymptotically standard normally distributed. The test is two-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

Anscombe FJ (1961). “Examination of Residuals.” In Neyman J (ed.), Fourth Berkeley Symposium on Mathematical Statistics and Probability June 20-July 30, 1960, 1–36. Berkeley: University of California Press.

Bickel PJ (1978). “Using Residuals Robustly I: Tests for Heteroscedasticity, Nonlinearity.” The Annals of Statistics, 6(2), 266–291.

Carroll RJ, Ruppert D (1981). “On Robust Tests for Heteroscedasticity.” The Annals of Statistics, 9(1), 206–210.

See Also

discussions of this test in Carroll and Ruppert (1981) and Ali and Giaccotto (1984).

Examples

mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
bickel(mtcars_lm)
bickel(mtcars_lm, fitmethod = "rlm")
bickel(mtcars_lm, scale_invariant = FALSE)


[Package skedastic version 2.0.2 Index]